From 5104cac97f9d08e218d03edf321e25d7f6d16c21 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Thu, 30 Jan 2020 17:05:51 -0800 Subject: [PATCH] BUTTON_ONE --- pylib/anki/consts.py | 1 + pylib/anki/sched.py | 6 +++--- pylib/anki/schedv2.py | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pylib/anki/consts.py b/pylib/anki/consts.py index e917f6d8a..e7618fa16 100644 --- a/pylib/anki/consts.py +++ b/pylib/anki/consts.py @@ -64,6 +64,7 @@ LEECH_SUSPEND = 0 LEECH_TAGONLY = 1 # Buttons +BUTTON_ONE = 1 # Labels ########################################################################## diff --git a/pylib/anki/sched.py b/pylib/anki/sched.py index eebb6f541..d2ca09ed0 100644 --- a/pylib/anki/sched.py +++ b/pylib/anki/sched.py @@ -874,7 +874,7 @@ select id from cards where did in %s and queue = 2 and due <= ? limit ?)""" def _answerRevCard(self, card, ease): delay = 0 - if ease == 1: + if ease == BUTTON_ONE: delay = self._rescheduleLapse(card) else: self._rescheduleRev(card, ease) @@ -1349,7 +1349,7 @@ To study outside of the normal schedule, click the Custom Study button below.""" "Return the next interval for CARD, in seconds." if card.queue in (0, 1, 3): return self._nextLrnIvl(card, ease) - elif ease == 1: + elif ease == BUTTON_ONE: # lapsed conf = self._lapseConf(card) if conf["delays"]: @@ -1364,7 +1364,7 @@ To study outside of the normal schedule, click the Custom Study button below.""" if card.queue == 0: card.left = self._startingLeft(card) conf = self._lrnConf(card) - if ease == 1: + if ease == BUTTON_ONE: # fail return self._delayForGrade(conf, len(conf["delays"])) elif ease == 3: diff --git a/pylib/anki/schedv2.py b/pylib/anki/schedv2.py index 444190bb1..dcdfe54d8 100644 --- a/pylib/anki/schedv2.py +++ b/pylib/anki/schedv2.py @@ -121,7 +121,7 @@ class Scheduler: def _answerCardPreview(self, card: Card, ease: int) -> None: assert 1 <= ease <= 2 - if ease == 1: + if ease == BUTTON_ONE: # repeat after delay card.queue = QUEUE_TYPE_PREVIEW card.due = intTime() + self._previewDelay(card) @@ -962,7 +962,7 @@ select id from cards where did in %s and queue = 2 and due <= ? limit ?)""" early = bool(card.odid and (card.odue > self.today)) type = early and 3 or 1 - if ease == 1: + if ease == BUTTON_ONE: delay = self._rescheduleLapse(card) else: self._rescheduleRev(card, ease, early) @@ -1557,14 +1557,14 @@ To study outside of the normal schedule, click the Custom Study button below.""" "Return the next interval for CARD, in seconds." # preview mode? if self._previewingCard(card): - if ease == 1: + if ease == BUTTON_ONE: return self._previewDelay(card) return 0 # (re)learning? if card.queue in (0, 1, QUEUE_TYPE_DAY_LEARN_RELEARN): return self._nextLrnIvl(card, ease) - elif ease == 1: + elif ease == BUTTON_ONE: # lapse conf = self._lapseConf(card) if conf["delays"]: @@ -1583,7 +1583,7 @@ To study outside of the normal schedule, click the Custom Study button below.""" if card.queue == 0: card.left = self._startingLeft(card) conf = self._lrnConf(card) - if ease == 1: + if ease == BUTTON_ONE: # fail return self._delayForGrade(conf, len(conf["delays"])) elif ease == 2: