mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 15:17:12 -05:00
add utils for adding/removing tags
This commit is contained in:
parent
f7c11f5771
commit
ce0df2652f
2 changed files with 13 additions and 1 deletions
|
|
@ -117,6 +117,18 @@ insert or replace into facts values (?, ?, ?, ?, ?, ?, ?, ?, ?)""",
|
||||||
def stringTags(self):
|
def stringTags(self):
|
||||||
return canonifyTags(self.tags)
|
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
|
# Unique/duplicate checks
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -537,7 +537,7 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % (
|
||||||
(card.lapses-lf) % (max(lf/2, 1)) == 0):
|
(card.lapses-lf) % (max(lf/2, 1)) == 0):
|
||||||
# add a leech tag
|
# add a leech tag
|
||||||
f = card.fact()
|
f = card.fact()
|
||||||
f.tags.append("leech")
|
f.addTag("leech")
|
||||||
f.flush()
|
f.flush()
|
||||||
# handle
|
# handle
|
||||||
if conf['leechAction'][0] == 0:
|
if conf['leechAction'][0] == 0:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue