mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
fix zero div issue, lim=0 turns off detection
This commit is contained in:
parent
eda8c2011a
commit
479b0b6ed5
1 changed files with 10 additions and 3 deletions
|
@ -452,9 +452,16 @@ Please do not file a bug report with Anki.<br>""")
|
|||
|
||||
def isLeech(self):
|
||||
no = self.currentCard.noCount
|
||||
max = self.deck.getInt('leechFails')
|
||||
return (not self.currentCard.successive and
|
||||
no >= max and (max - no) % (max/2) == 0)
|
||||
fmax = self.deck.getInt('leechFails')
|
||||
if not fmax:
|
||||
return
|
||||
return (
|
||||
# failed
|
||||
not self.currentCard.successive and
|
||||
# greater than fail threshold
|
||||
no >= fmax and
|
||||
# at least threshold/2 reps since last time
|
||||
(fmax - no) % (max(fmax/2, 1)) == 0)
|
||||
|
||||
def handleLeech(self):
|
||||
self.deck.refresh()
|
||||
|
|
Loading…
Reference in a new issue