fix finished screen not showing when learning cards due later
This commit is contained in:
parent
110a481a24
commit
31a3add848
@ -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(
|
||||
|
@ -158,11 +158,10 @@ class Overview:
|
||||
shareLink = '<a class=smallLink href="review">Reviews and Updates</a>'
|
||||
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 '<div class="descfont descmid description %s">%s</div>' % (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 """
|
||||
<table width=400 cellpadding=5>
|
||||
<tr><td align=center valign=top>
|
||||
<table cellspacing=5>
|
||||
@ -213,14 +207,14 @@ class Overview:
|
||||
</table>
|
||||
</td><td align=center>
|
||||
%s</td></tr></table>""" % (
|
||||
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 = """
|
||||
<center>
|
||||
|
Loading…
Reference in New Issue
Block a user