mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
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
This commit is contained in:
parent
609e165c95
commit
336b1e7c58
1 changed files with 4 additions and 10 deletions
|
@ -901,21 +901,15 @@ did = ?, queue = %s, due = ?, mod = ?, usn = ? where id = ?""" % queue, data)
|
||||||
self.today = int((time.time() - self.col.crt) / 86400)
|
self.today = int((time.time() - self.col.crt) / 86400)
|
||||||
# end of day cutoff
|
# end of day cutoff
|
||||||
self.dayCutoff = self.col.crt + (self.today+1)*86400
|
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):
|
def update(g):
|
||||||
save = False
|
|
||||||
for t in "new", "rev", "lrn", "time":
|
for t in "new", "rev", "lrn", "time":
|
||||||
key = t+"Today"
|
key = t+"Today"
|
||||||
if g[key][0] != self.today:
|
if g[key][0] != self.today:
|
||||||
save = True
|
|
||||||
g[key] = [self.today, 0]
|
g[key] = [self.today, 0]
|
||||||
if save:
|
for deck in self.col.decks.all():
|
||||||
self.col.decks.save(g)
|
update(deck)
|
||||||
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)
|
|
||||||
|
|
||||||
def _checkDay(self):
|
def _checkDay(self):
|
||||||
# check if the day has rolled over
|
# check if the day has rolled over
|
||||||
|
|
Loading…
Reference in a new issue