From 336b1e7c5828de2b9e8085e4089ee00acbe88e52 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 19 Apr 2012 02:45:46 +0900 Subject: [PATCH] fix bugs with daily counts - When we reset() the deck, we need to update the daily counts for all decks, not just the selected ones, or the deck list is inaccurate - We don't want to save the decks at that time, or simply opening Anki on another machine will cause a conflict with all decks --- anki/sched.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/anki/sched.py b/anki/sched.py index 0be8fe6f6..a47ea2cec 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -901,21 +901,15 @@ did = ?, queue = %s, due = ?, mod = ?, usn = ? where id = ?""" % queue, data) self.today = int((time.time() - self.col.crt) / 86400) # end of day cutoff self.dayCutoff = self.col.crt + (self.today+1)*86400 - # update all selected decks + # update all daily counts, but don't save decks to prevent needless + # conflicts. we'll save on card answer instead def update(g): - save = False for t in "new", "rev", "lrn", "time": key = t+"Today" if g[key][0] != self.today: - save = True g[key] = [self.today, 0] - if save: - self.col.decks.save(g) - for did in self.col.decks.active(): - update(self.col.decks.get(did)) - # update parents too - for grp in self.col.decks.parents(self.col.decks.selected()): - update(grp) + for deck in self.col.decks.all(): + update(deck) def _checkDay(self): # check if the day has rolled over