ensure lapsed reviews are scheduled for tomorrow on graduate

This commit is contained in:
Damien Elmes 2012-04-07 14:28:41 +09:00
parent 2f75e99671
commit bbac32b477
3 changed files with 26 additions and 3 deletions

View file

@ -350,7 +350,7 @@ n.mid in %s and n.id %s in %s""" % (
token['value'] = token['value'][3:].lower()
type = SEARCH_TYPE
elif token['value'].startswith("note:"):
token['value'] = token['value'][6:].lower()
token['value'] = token['value'][5:].lower()
type = SEARCH_MODEL
elif token['value'].startswith("deck:"):
token['value'] = token['value'][5:].lower()

View file

@ -468,7 +468,8 @@ limit %d""" % (self._deckLimit(), self.reportLimit), lim=self.dayCutoff)
def _rescheduleAsRev(self, card, conf, early):
if card.type == 2:
card.due = card.odue
card.due = max(self.today+1, card.odue)
card.odue = 0
else:
self._rescheduleNew(card, conf, early)
card.queue = 2

View file

@ -230,7 +230,6 @@ def test_reviews():
c.due = d.sched.today - 8
c.factor = 2500
c.reps = 3
c.streak = 2
c.lapses = 1
c.ivl = 100
c.startTimer()
@ -310,6 +309,29 @@ def test_reviews():
c.load()
assert c.queue == -1
def test_overdue_lapse():
d = getEmptyDeck()
# add a note
f = d.newNote()
f['Front'] = u"one"
d.addNote(f)
# simulate a review that was lapsed and is now due for its normal review
c = f.cards()[0]
c.type = 2
c.queue = 1
c.due = -1
c.odue = -1
c.factor = 2500
c.left = 2
c.ivl = 0
c.flush()
d.sched.reset()
assert d.sched.counts() == (0, 2, 0)
c = d.sched.getCard()
d.sched.answerCard(c, 3)
# it should be due tomorrow
assert c.due == d.sched.today + 1
def test_finished():
d = getEmptyDeck()
# nothing due