when the day rolls over, update due cutoffs too, and rebuild queue

This commit is contained in:
Damien Elmes 2011-02-02 23:52:34 +09:00
parent e49a9bb5ac
commit 1464394d58

View file

@ -467,10 +467,11 @@ where type >= 0
self.newSpacing = self.getFloat('newSpacing') self.newSpacing = self.getFloat('newSpacing')
self.revSpacing = self.getFloat('revSpacing') self.revSpacing = self.getFloat('revSpacing')
def checkDailyStats(self): def checkDay(self):
# check if the day has rolled over # check if the day has rolled over
if genToday(self) != self._dailyStats.day: if genToday(self) != self._dailyStats.day:
self._dailyStats = dailyStats(self) self.updateCutoff()
self.reset()
# Review early # Review early
########################################################################## ##########################################################################
@ -579,7 +580,7 @@ order by combinedDue limit %d""" % self.queueLimit), lim=self.dueCutoff)
self.failedCramQueue.insert(0, [card.id, card.factId]) self.failedCramQueue.insert(0, [card.id, card.factId])
def _getCramCardId(self, check=True): def _getCramCardId(self, check=True):
self.checkDailyStats() self.checkDay()
self.fillQueues() self.fillQueues()
if self.failedCardMax and self.failedSoonCount >= self.failedCardMax: if self.failedCardMax and self.failedSoonCount >= self.failedCardMax:
return self.failedQueue[-1][0] return self.failedQueue[-1][0]
@ -662,7 +663,7 @@ limit %s""" % (self.cramOrder, self.queueLimit)))
def _getCardId(self, check=True): def _getCardId(self, check=True):
"Return the next due card id, or None." "Return the next due card id, or None."
self.checkDailyStats() self.checkDay()
self.fillQueues() self.fillQueues()
self.updateNewCountToday() self.updateNewCountToday()
if self.failedQueue: if self.failedQueue: