diff --git a/pylib/anki/sched.py b/pylib/anki/sched.py index 66749fd62..c6b09f735 100644 --- a/pylib/anki/sched.py +++ b/pylib/anki/sched.py @@ -1128,11 +1128,11 @@ did = ?, queue = %s, due = ?, usn = ? where id = ?""" # Leeches ########################################################################## - def _checkLeech(self, card, conf): + def _checkLeech(self, card, conf) -> bool: "Leech handler. True if card was a leech." lf = conf["leechFails"] if not lf: - return + return False # if over threshold or every half threshold reps after that if card.lapses >= lf and (card.lapses - lf) % (max(lf // 2, 1)) == 0: # add a leech tag @@ -1152,6 +1152,8 @@ did = ?, queue = %s, due = ?, usn = ? where id = ?""" # notify UI hooks.card_did_leech(card) return True + else: + return False # Tools ########################################################################## diff --git a/pylib/anki/schedv2.py b/pylib/anki/schedv2.py index 3959def11..70ed31774 100644 --- a/pylib/anki/schedv2.py +++ b/pylib/anki/schedv2.py @@ -1254,11 +1254,11 @@ where id = ? # Leeches ########################################################################## - def _checkLeech(self, card: Card, conf: Dict[str, Any]) -> Optional[bool]: + def _checkLeech(self, card: Card, conf: Dict[str, Any]) -> bool: "Leech handler. True if card was a leech." lf = conf["leechFails"] if not lf: - return None + return False # if over threshold or every half threshold reps after that if card.lapses >= lf and (card.lapses - lf) % (max(lf // 2, 1)) == 0: # add a leech tag @@ -1272,7 +1272,7 @@ where id = ? # notify UI hooks.card_did_leech(card) return True - return None + return False # Tools ##########################################################################