From 095aa6dc84029755f2354bf6a1eab92e1a0ed65f Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 15 Nov 2008 17:56:54 +0900 Subject: [PATCH] check daily stats in check due, no need to call separately --- anki/deck.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/anki/deck.py b/anki/deck.py index 218d34411..4fd160046 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -262,7 +262,6 @@ where factId in (select factId from %s limit 60))""" % new) def answerCard(self, card, ease): t = time.time() - self.checkDailyStats() now = time.time() oldState = self.cardState(card) lastDelay = max(0, (time.time() - card.due) / 86400.0) @@ -355,8 +354,7 @@ end)""" + where) def checkDue(self): "Mark expired cards due, and update counts." - t2 = time.time() - t = time.time() + self.checkDailyStats() # mark due & update counts stmt = """ update cards set @@ -364,27 +362,20 @@ isDue = 1 where type = %d and isDue = 0 and priority in (1,2,3,4) and combinedDue < :now""" self.failedNowCount += self.s.statement( stmt % 0, now=time.time()).rowcount - #print "set1", time.time() - t; t = time.time() - #self.engine.echo = True self.revCount += self.s.statement( stmt % 1, now=time.time()).rowcount - #self.engine.echo = False - #print "set2", time.time() - t; t = time.time() self.newCount += self.s.statement( stmt % 2, now=time.time()).rowcount - #print "set3", time.time() - t; t = time.time() self.failedSoonCount = (self.failedNowCount + self.s.scalar(""" select count(*) from cards where type = 0 and isDue = 0 and priority in (1,2,3,4) and combinedDue <= (select max(delay0, delay1) + strftime("%s", "now")+1 from decks)""")) - #print "set4", time.time() - t; t = time.time() # new card handling self.newCountToday = max(min( self.newCount, self.newCardsPerDay - self.newCardsToday()), 0) - #print "me indv", time.time() - t2 def rebuildQueue(self): "Update relative delays based on current time."