fix incorrectly logged repeat step
https://anki.tenderapp.com/discussions/ankidesktop/38130-anki-21-scheduler-misleads-on-hard-button-for-learning-cards
This commit is contained in:
parent
fbf0f94bcc
commit
a9c93d933c
@ -798,7 +798,13 @@ did = ? and queue = {QUEUE_TYPE_DAY_LEARN_RELEARN} and due <= ? limit ?""",
|
||||
lastLeft: int,
|
||||
) -> None:
|
||||
lastIvl = -(self._delayForGrade(conf, lastLeft))
|
||||
ivl = card.ivl if leaving else -(self._delayForGrade(conf, card.left))
|
||||
if leaving:
|
||||
ivl = card.ivl
|
||||
else:
|
||||
if ease == 2:
|
||||
ivl = -self._delayForRepeatingGrade(conf, card.left)
|
||||
else:
|
||||
ivl = -self._delayForGrade(conf, card.left)
|
||||
|
||||
def log():
|
||||
self.col.db.execute(
|
||||
|
@ -1281,3 +1281,23 @@ def test_negativeDueFilter():
|
||||
|
||||
c.load()
|
||||
assert c.due == -5
|
||||
|
||||
|
||||
# hard on the first step should be the average of again and good,
|
||||
# and it should be logged properly
|
||||
def test_initial_repeat():
|
||||
d = getEmptyCol()
|
||||
f = d.newNote()
|
||||
f["Front"] = "one"
|
||||
f["Back"] = "two"
|
||||
d.addNote(f)
|
||||
|
||||
d.reset()
|
||||
c = d.sched.getCard()
|
||||
d.sched.answerCard(c, 2)
|
||||
# should be due in ~ 5.5 mins
|
||||
expected = time.time() + 5.5 * 60
|
||||
assert expected - 10 < c.due < expected * 1.25
|
||||
|
||||
ivl = d.db.scalar("select ivl from revlog")
|
||||
assert ivl == -5.5 * 60
|
||||
|
Loading…
Reference in New Issue
Block a user