From 10757d563df1c5460f836c67f5bb97b4fae8456d Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 23 Jan 2021 14:00:03 +1000 Subject: [PATCH] refresh new/rev counts when fillNew/fillRev() fails This was the behaviour before, but got lost when ._reset_counts() was added. Also added the check back to schedv2:fillRev(), which also appears to have gotten lost in the move to ._reset_counts() Just a stop-gap fix until this code can get a proper rewrite. --- pylib/anki/sched.py | 1 + pylib/anki/schedv2.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pylib/anki/sched.py b/pylib/anki/sched.py index 333c4d8e0..7c60fda30 100644 --- a/pylib/anki/sched.py +++ b/pylib/anki/sched.py @@ -492,6 +492,7 @@ did = ? and queue = {QUEUE_TYPE_REV} and due <= ? limit ?""", if recursing: print("bug: fillRev()") return False + self._reset_counts() self._resetRev() return self._fillRev(recursing=True) diff --git a/pylib/anki/schedv2.py b/pylib/anki/schedv2.py index 55de8e7b9..af5dde895 100644 --- a/pylib/anki/schedv2.py +++ b/pylib/anki/schedv2.py @@ -346,6 +346,7 @@ order by due""" if recursing: print("bug: fillNew()") return False + self._reset_counts() self._resetNew() return self._fillNew(recursing=True) @@ -862,7 +863,12 @@ limit ?""" self._revQueue.reverse() return True - return False + if recursing: + print("bug: fillRev2()") + return False + self._reset_counts() + self._resetRev() + return self._fillRev(recursing=True) def _getRevCard(self) -> Optional[Card]: if self._fillRev():