fix no relearn steps case in v2 sched
This commit is contained in:
parent
ebe420b440
commit
0b42787ffc
@ -551,20 +551,16 @@ did = ? and queue = 3 and due <= ? limit ?""",
|
|||||||
|
|
||||||
self._logLrn(card, ease, conf, leaving, type, lastLeft)
|
self._logLrn(card, ease, conf, leaving, type, lastLeft)
|
||||||
|
|
||||||
|
def _updateRevIvlOnFail(self, card, conf):
|
||||||
|
card.lastIvl = card.ivl
|
||||||
|
card.ivl = self._lapseIvl(card, conf)
|
||||||
|
|
||||||
def _moveToFirstStep(self, card, conf):
|
def _moveToFirstStep(self, card, conf):
|
||||||
card.left = self._startingLeft(card)
|
card.left = self._startingLeft(card)
|
||||||
|
|
||||||
card.lastIvl = card.ivl
|
|
||||||
|
|
||||||
# relearning card?
|
# relearning card?
|
||||||
if card.type in (2,3):
|
if card.type == 3:
|
||||||
card.ivl = self._lapseIvl(card, self._lrnConf(card))
|
self._updateRevIvlOnFail(card, conf)
|
||||||
|
|
||||||
# moving from review queue?
|
|
||||||
if card.type == 2:
|
|
||||||
card.type = 3
|
|
||||||
card.lapses += 1
|
|
||||||
card.factor = max(1300, card.factor-200)
|
|
||||||
|
|
||||||
return self._rescheduleLrnCard(card, conf)
|
return self._rescheduleLrnCard(card, conf)
|
||||||
|
|
||||||
@ -831,11 +827,18 @@ select id from cards where did in %s and queue = 2 and due <= ? limit ?)"""
|
|||||||
|
|
||||||
def _rescheduleLapse(self, card):
|
def _rescheduleLapse(self, card):
|
||||||
conf = self._lapseConf(card)
|
conf = self._lapseConf(card)
|
||||||
|
|
||||||
|
card.lapses += 1
|
||||||
|
card.factor = max(1300, card.factor-200)
|
||||||
|
|
||||||
if conf['delays']:
|
if conf['delays']:
|
||||||
|
card.type = 3
|
||||||
delay = self._moveToFirstStep(card, conf)
|
delay = self._moveToFirstStep(card, conf)
|
||||||
else:
|
else:
|
||||||
# no relearning steps
|
# no relearning steps
|
||||||
|
self._updateRevIvlOnFail(card, conf)
|
||||||
self._rescheduleAsRev(card, conf, early=False)
|
self._rescheduleAsRev(card, conf, early=False)
|
||||||
|
delay = 0
|
||||||
|
|
||||||
# if suspended as a leech, nothing to do
|
# if suspended as a leech, nothing to do
|
||||||
if self._checkLeech(card, conf) and card.queue == -1:
|
if self._checkLeech(card, conf) and card.queue == -1:
|
||||||
|
@ -194,6 +194,27 @@ def test_relearn():
|
|||||||
assert c.ivl == 1
|
assert c.ivl == 1
|
||||||
assert c.due == d.sched.today + c.ivl
|
assert c.due == d.sched.today + c.ivl
|
||||||
|
|
||||||
|
def test_relearn_no_steps():
|
||||||
|
d = getEmptyCol()
|
||||||
|
f = d.newNote()
|
||||||
|
f['Front'] = "one"
|
||||||
|
d.addNote(f)
|
||||||
|
c = f.cards()[0]
|
||||||
|
c.ivl = 100
|
||||||
|
c.due = d.sched.today
|
||||||
|
c.type = c.queue = 2
|
||||||
|
c.flush()
|
||||||
|
|
||||||
|
conf = d.decks.confForDid(1)
|
||||||
|
conf['lapse']['delays'] = []
|
||||||
|
d.decks.save(conf)
|
||||||
|
|
||||||
|
# fail the card
|
||||||
|
d.reset()
|
||||||
|
c = d.sched.getCard()
|
||||||
|
d.sched.answerCard(c, 1)
|
||||||
|
assert c.type == c.queue == 2
|
||||||
|
|
||||||
def test_learn_collapsed():
|
def test_learn_collapsed():
|
||||||
d = getEmptyCol()
|
d = getEmptyCol()
|
||||||
# add 2 notes
|
# add 2 notes
|
||||||
|
Loading…
Reference in New Issue
Block a user