mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
ensure we give correct intervals for new cards
This commit is contained in:
parent
001a69db43
commit
699839188b
2 changed files with 15 additions and 8 deletions
|
@ -754,7 +754,10 @@ gid in %s and queue = 2 and due <= :lim %s limit %d""" % (
|
||||||
# early removal
|
# early removal
|
||||||
return self._graduatingIvl(card, conf, True) * 86400
|
return self._graduatingIvl(card, conf, True) * 86400
|
||||||
else:
|
else:
|
||||||
left = card.left - 1
|
if card.queue == 0:
|
||||||
|
left = self._startingLeft(card) - 1
|
||||||
|
else:
|
||||||
|
left = card.left - 1
|
||||||
if left <= 0:
|
if left <= 0:
|
||||||
# graduate
|
# graduate
|
||||||
return self._graduatingIvl(card, conf, False) * 86400
|
return self._graduatingIvl(card, conf, False) * 86400
|
||||||
|
|
|
@ -299,23 +299,27 @@ def test_nextIvl():
|
||||||
f = d.newFact()
|
f = d.newFact()
|
||||||
f['Front'] = u"one"; f['Back'] = u"two"
|
f['Front'] = u"one"; f['Back'] = u"two"
|
||||||
d.addFact(f)
|
d.addFact(f)
|
||||||
c = f.cards()[0]
|
d.reset()
|
||||||
|
c = d.sched.getCard()
|
||||||
d.sched._cardConf(c)['new']['delays'] = [0.5, 3, 10]
|
d.sched._cardConf(c)['new']['delays'] = [0.5, 3, 10]
|
||||||
d.sched._cardConf(c)['lapse']['delays'] = [0.5, 3, 10]
|
d.sched._cardConf(c)['lapse']['delays'] = [0.5, 3, 10]
|
||||||
# cards in learning
|
# new cards
|
||||||
##################################################
|
##################################################
|
||||||
c.left = 3
|
|
||||||
ni = d.sched.nextIvl
|
ni = d.sched.nextIvl
|
||||||
assert ni(c, 1) == 30
|
assert ni(c, 1) == 30
|
||||||
assert ni(c, 2) == 180
|
assert ni(c, 2) == 180
|
||||||
# removal is 4 days
|
|
||||||
assert ni(c, 3) == 4*86400
|
assert ni(c, 3) == 4*86400
|
||||||
c.left -= 1
|
d.sched.answerCard(c, 1)
|
||||||
|
# cards in learning
|
||||||
|
##################################################
|
||||||
|
assert ni(c, 1) == 30
|
||||||
|
assert ni(c, 2) == 180
|
||||||
|
assert ni(c, 3) == 4*86400
|
||||||
|
d.sched.answerCard(c, 2)
|
||||||
assert ni(c, 1) == 30
|
assert ni(c, 1) == 30
|
||||||
assert ni(c, 2) == 600
|
assert ni(c, 2) == 600
|
||||||
# no first time bonus
|
|
||||||
assert ni(c, 3) == 4*86400
|
assert ni(c, 3) == 4*86400
|
||||||
c.left = 1
|
d.sched.answerCard(c, 2)
|
||||||
# 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
|
||||||
|
|
Loading…
Reference in a new issue