Limit tags in custom study dialog to those in the selected deck
This commit is contained in:
parent
52f8a4a75e
commit
1f1220cf7c
13
anki/tags.py
13
anki/tags.py
@ -67,6 +67,19 @@ class TagManager(object):
|
||||
def save(self):
|
||||
self.changed = True
|
||||
|
||||
def byDeck(self, did, children=False):
|
||||
basequery = "select n.tags from cards c, notes n WHERE c.nid = n.id"
|
||||
if not children:
|
||||
query = basequery + " AND c.did=?"
|
||||
res = self.col.db.list(query, did)
|
||||
return list(set(self.split(" ".join(res))))
|
||||
dids = [did]
|
||||
for name, id in self.col.decks.children(did):
|
||||
dids.append(id)
|
||||
query = basequery + " AND c.did IN " + ids2str(dids)
|
||||
res = self.col.db.list(query)
|
||||
return list(set(self.split(" ".join(res))))
|
||||
|
||||
# Bulk addition/removal from notes
|
||||
#############################################################
|
||||
|
||||
|
@ -19,7 +19,7 @@ class TagLimit(QDialog):
|
||||
self.exec_()
|
||||
|
||||
def rebuildTagList(self):
|
||||
usertags = self.mw.col.tags.all()
|
||||
usertags = self.mw.col.tags.byDeck(self.deck['id'], True)
|
||||
yes = self.deck.get("activeTags", [])
|
||||
no = self.deck.get("inactiveTags", [])
|
||||
yesHash = {}
|
||||
|
Loading…
Reference in New Issue
Block a user