From 78ee6884f554bcf28f6e5660ae74939f0a614a18 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 30 Mar 2009 08:23:21 +0900 Subject: [PATCH] make sure to account for failed cards not due yet --- anki/deck.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/anki/deck.py b/anki/deck.py index 27301dff0..77e47b47e 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -364,10 +364,17 @@ where factId = :fid and id != :id""", fid=card.factId, id=card.id) or 0 space = max(minSpacing, space) space += time.time() # check what other cards we've spaced + if self.reviewEarly: + extra = "" + else: + # if not reviewing early, make sure the current card is counted + # even if it was not due yet (it's a failed card) + extra = "or id = :cid" for (type, count) in self.s.all(""" select type, count(type) from cards -where factId = :fid and isDue = 1 -group by type""", fid=card.factId): +where factId = :fid and +(isDue = 1 %s) +group by type""" % extra, fid=card.factId, cid=card.id): if type == 0: self.failedSoonCount -= count elif type == 1: