fix an issue where non-new cards were not reset on export

only happened for cards in a filtered deck
This commit is contained in:
Damien Elmes 2013-10-30 23:28:52 +09:00
parent d8149910eb
commit e5d7a69631

View File

@ -1359,11 +1359,17 @@ usn=:usn, mod=:mod, factor=:fact where id=:id and odid=0 and queue >=0""",
def resetCards(self, ids):
"Completely reset cards for export."
sids = ids2str(ids)
# we want to avoid resetting due number of existing new cards on export
nonNew = self.col.db.list(
"select id from cards where id in %s and (queue != 0 or type != 0)"
% ids2str(ids))
% sids)
# reset all cards
self.col.db.execute(
"update cards set reps=0, lapses=0 where id in " + ids2str(nonNew))
"update cards set reps=0,lapses=0,odid=0,odue=0"
" where id in %s" % sids
)
# and forget any non-new cards, changing their due numbers
self.forgetCards(nonNew)
self.col.log(ids)