make sure to account for failed cards not due yet

This commit is contained in:
Damien Elmes 2009-03-30 08:23:21 +09:00
parent e25e8ff0ed
commit 78ee6884f5

View file

@ -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: