diff --git a/pylib/anki/consts.py b/pylib/anki/consts.py index e7618fa16..e8625d07e 100644 --- a/pylib/anki/consts.py +++ b/pylib/anki/consts.py @@ -65,6 +65,7 @@ LEECH_TAGONLY = 1 # Buttons BUTTON_ONE = 1 +BUTTON_TWO = 2 # Labels ########################################################################## diff --git a/pylib/anki/sched.py b/pylib/anki/sched.py index d2ca09ed0..f2428b07c 100644 --- a/pylib/anki/sched.py +++ b/pylib/anki/sched.py @@ -569,12 +569,12 @@ did = ? and queue = 3 and due <= ? limit ?""", self._rescheduleAsRev(card, conf, True) leaving = True # graduation time? - elif ease == 2 and (card.left % 1000) - 1 <= 0: + elif ease == BUTTON_TWO and (card.left % 1000) - 1 <= 0: self._rescheduleAsRev(card, conf, False) leaving = True else: # one step towards graduation - if ease == 2: + if ease == BUTTON_TWO: # decrement real left count and recalculate left today left = (card.left % 1000) - 1 card.left = self._leftToday(conf["delays"], left) * 1000 + left @@ -969,7 +969,7 @@ select id from cards where did in %s and queue = 2 and due <= ? limit ?)""" ivl4 = self._constrainedIvl( (card.ivl + delay) * fct * conf["ease4"], conf, ivl3 ) - if ease == 2: + if ease == BUTTON_TWO: interval = ivl2 elif ease == 3: interval = ivl3 diff --git a/pylib/anki/schedv2.py b/pylib/anki/schedv2.py index dcdfe54d8..8b9885e90 100644 --- a/pylib/anki/schedv2.py +++ b/pylib/anki/schedv2.py @@ -127,6 +127,7 @@ class Scheduler: card.due = intTime() + self._previewDelay(card) self.lrnCount += 1 else: + # BUTTON_TWO # restore original card state and remove from filtered deck self._restorePreviewCard(card) self._removeFromFiltered(card) @@ -627,7 +628,7 @@ did = ? and queue = {QUEUE_TYPE_DAY_LEARN_RELEARN} and due <= ? limit ?""", leaving = True else: self._moveToNextStep(card, conf) - elif ease == 2: + elif ease == BUTTON_TWO: self._repeatStep(card, conf) else: # back to first step @@ -801,7 +802,7 @@ did = ? and queue = {QUEUE_TYPE_DAY_LEARN_RELEARN} and due <= ? limit ?""", if leaving: ivl = card.ivl else: - if ease == 2: + if ease == BUTTON_TWO: ivl = -self._delayForRepeatingGrade(conf, card.left) else: ivl = -self._delayForGrade(conf, card.left) @@ -1047,7 +1048,7 @@ select id from cards where did in %s and queue = 2 and due <= ? limit ?)""" else: hardMin = 0 ivl2 = self._constrainedIvl(card.ivl * hardFactor, conf, hardMin, fuzz) - if ease == 2: + if ease == BUTTON_TWO: return ivl2 ivl3 = self._constrainedIvl((card.ivl + delay // 2) * fct, conf, ivl2, fuzz) @@ -1113,7 +1114,7 @@ select id from cards where did in %s and queue = 2 and due <= ? limit ?)""" # early 3/4 reviews shouldn't decrease previous interval minNewIvl = 1 - if ease == 2: + if ease == BUTTON_TWO: factor = conf.get("hardFactor", 1.2) # hard cards shouldn't have their interval decreased by more than 50% # of the normal factor @@ -1586,7 +1587,7 @@ To study outside of the normal schedule, click the Custom Study button below.""" if ease == BUTTON_ONE: # fail return self._delayForGrade(conf, len(conf["delays"])) - elif ease == 2: + elif ease == BUTTON_TWO: return self._delayForRepeatingGrade(conf, card.left) elif ease == 4: return self._graduatingIvl(card, conf, True, fuzz=False) * 86400