mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
fix interval calculation for lapsed cards in learning queue
This commit is contained in:
parent
4d0e4836fe
commit
e407697fb9
2 changed files with 12 additions and 1 deletions
|
@ -245,6 +245,9 @@ limit %d""" % self.reportLimit, lim=self.dayCutoff)
|
||||||
card.type = 2
|
card.type = 2
|
||||||
|
|
||||||
def _graduatingIvl(self, card, conf, early):
|
def _graduatingIvl(self, card, conf, early):
|
||||||
|
if card.type == 2:
|
||||||
|
# lapsed card being relearnt
|
||||||
|
return card.ivl
|
||||||
if not early:
|
if not early:
|
||||||
# graduate
|
# graduate
|
||||||
ideal = conf['ints'][0]
|
ideal = conf['ints'][0]
|
||||||
|
@ -557,7 +560,6 @@ queue = 2 %s and due <= :lim order by %s limit %d""" % (
|
||||||
def nextIvl(self, card, ease):
|
def nextIvl(self, card, ease):
|
||||||
"Return the next interval for CARD, in seconds."
|
"Return the next interval for CARD, in seconds."
|
||||||
if card.queue in (0,1):
|
if card.queue in (0,1):
|
||||||
# in learning
|
|
||||||
return self._nextLrnIvl(card, ease)
|
return self._nextLrnIvl(card, ease)
|
||||||
elif ease == 1:
|
elif ease == 1:
|
||||||
# lapsed
|
# lapsed
|
||||||
|
|
|
@ -256,6 +256,14 @@ def test_nextIvl():
|
||||||
# normal graduation is tomorrow
|
# normal graduation is tomorrow
|
||||||
assert ni(c, 2) == 1*86400
|
assert ni(c, 2) == 1*86400
|
||||||
assert ni(c, 3) == 4*86400
|
assert ni(c, 3) == 4*86400
|
||||||
|
# lapsed cards
|
||||||
|
##################################################
|
||||||
|
c.type = 2
|
||||||
|
c.ivl = 100
|
||||||
|
c.factor = 2500
|
||||||
|
assert ni(c, 1) == 30
|
||||||
|
assert ni(c, 2) == 100*86400
|
||||||
|
assert ni(c, 3) == 100*86400
|
||||||
# review cards
|
# review cards
|
||||||
##################################################
|
##################################################
|
||||||
c.queue = 2
|
c.queue = 2
|
||||||
|
@ -356,6 +364,7 @@ def test_cram():
|
||||||
d.sched.answerCard(c, 1)
|
d.sched.answerCard(c, 1)
|
||||||
# graduating the card will keep the same interval, but shift the card
|
# graduating the card will keep the same interval, but shift the card
|
||||||
# forward the number of days it had been waiting (75)
|
# forward the number of days it had been waiting (75)
|
||||||
|
print d.sched.nextIvl(c, 3)
|
||||||
assert d.sched.nextIvl(c, 3) == 75*86400
|
assert d.sched.nextIvl(c, 3) == 75*86400
|
||||||
d.sched.answerCard(c, 3)
|
d.sched.answerCard(c, 3)
|
||||||
assert c.ivl == 100
|
assert c.ivl == 100
|
||||||
|
|
Loading…
Reference in a new issue