diff --git a/pylib/anki/schedv2.py b/pylib/anki/schedv2.py index af5dde895..21d2c79ed 100644 --- a/pylib/anki/schedv2.py +++ b/pylib/anki/schedv2.py @@ -176,9 +176,11 @@ class Scheduler: # current deck points to a missing deck self.newCount = 0 self.revCount = 0 + self._immediate_learn_count = 0 else: self.newCount = node.new_count self.revCount = node.review_count + self._immediate_learn_count = node.learn_count def counts(self, card: Optional[Card] = None) -> Tuple[int, int, int]: counts = [self.newCount, self.lrnCount, self.revCount] @@ -188,6 +190,10 @@ class Scheduler: new, lrn, rev = counts return (new, lrn, rev) + def _is_finished(self): + "Don't use this, it is a stop-gap until this code is refactored." + return not any((self.newCount, self.revCount, self._immediate_learn_count)) + def dueForecast(self, days: int = 7) -> List[Any]: "Return counts over next DAYS. Includes today." daysd: Dict[int, int] = dict( diff --git a/qt/aqt/overview.py b/qt/aqt/overview.py index 08a514862..52c3ad52b 100644 --- a/qt/aqt/overview.py +++ b/qt/aqt/overview.py @@ -158,11 +158,10 @@ class Overview: shareLink = 'Reviews and Updates' else: shareLink = "" - table_text = self._table() - if not table_text: - # deck is finished + if self.mw.col.sched._is_finished(): self._show_finished_screen() return + table_text = self._table() content = OverviewContent( deck=deck["name"], shareLink=shareLink, @@ -196,14 +195,9 @@ class Overview: return '
%s
' % (dyn, desc) def _table(self) -> Optional[str]: - "Return table text if deck is not finished." counts = list(self.mw.col.sched.counts()) - finished = not sum(counts) but = self.mw.button - if finished: - return None - else: - return """ + return """
@@ -213,14 +207,14 @@ class Overview:
%s
""" % ( - tr(TR.ACTIONS_NEW), - counts[0], - tr(TR.SCHEDULING_LEARNING), - counts[1], - tr(TR.STUDYING_TO_REVIEW), - counts[2], - but("study", tr(TR.STUDYING_STUDY_NOW), id="study", extra=" autofocus"), - ) + tr(TR.ACTIONS_NEW), + counts[0], + tr(TR.SCHEDULING_LEARNING), + counts[1], + tr(TR.STUDYING_TO_REVIEW), + counts[2], + but("study", tr(TR.STUDYING_STUDY_NOW), id="study", extra=" autofocus"), + ) _body = """