fix finished screen not showing when learning cards due later

This commit is contained in:
Damien Elmes 2021-01-25 21:11:03 +10:00
parent 110a481a24
commit 31a3add848
2 changed files with 17 additions and 17 deletions

View File

@ -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(

View File

@ -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,13 +195,8 @@ 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 """
<table width=400 cellpadding=5>
<tr><td align=center valign=top>