diff --git a/anki/facts.py b/anki/facts.py index a5b3208b6..f55f4edac 100644 --- a/anki/facts.py +++ b/anki/facts.py @@ -117,6 +117,18 @@ insert or replace into facts values (?, ?, ?, ?, ?, ?, ?, ?, ?)""", def stringTags(self): return canonifyTags(self.tags) + def delTag(self, tag): + rem = [] + for t in self.tags: + if t.lower() == tag.lower(): + rem.append(t) + for r in rem: + self.tags.remove(r) + + def addTag(self, tag): + # duplicates will be stripped on save + self.tags.append(tag) + # Unique/duplicate checks ################################################## diff --git a/anki/sched.py b/anki/sched.py index e8ea87f3a..7fb75cc8e 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -537,7 +537,7 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % ( (card.lapses-lf) % (max(lf/2, 1)) == 0): # add a leech tag f = card.fact() - f.tags.append("leech") + f.addTag("leech") f.flush() # handle if conf['leechAction'][0] == 0: