Merge pull request #121 from rizzomichaelg/patch-1

Adding new cloze while in filtered deck
This commit is contained in:
Damien Elmes 2016-04-10 14:20:03 +10:00
commit 1b0750ba9b

View File

@ -304,12 +304,15 @@ crt=?, mod=?, scm=?, dty=?, usn=?, ls=?, conf=?""",
snids = ids2str(nids) snids = ids2str(nids)
have = {} have = {}
dids = {} dids = {}
for id, nid, ord, did in self.db.execute( for id, nid, ord, did, odid in self.db.execute(
"select id, nid, ord, did from cards where nid in "+snids): "select id, nid, ord, did, odid from cards where nid in "+snids):
# existing cards # existing cards
if nid not in have: if nid not in have:
have[nid] = {} have[nid] = {}
have[nid][ord] = id have[nid][ord] = id
# if in a filtered deck, add new cards to original deck
if odid != 0:
did = odid
# and their dids # and their dids
if nid in dids: if nid in dids:
if dids[nid] and dids[nid] != did: if dids[nid] and dids[nid] != did: