Show buried until daily limits in overview screen (#1664)

* Show buried until daily limits in overview screen

This explains differences between the counts shown in the deck tree and
those shown in the overview screen.

Closes #1633.

* interday learning cards can be buried too (dae)

* add 'buried' tooltip to bury counts; generate row in helper fn (dae)

* Use grey for buried counts
This commit is contained in:
RumovZ 2022-02-14 09:57:01 +01:00 committed by GitHub
parent d4f27d1d56
commit 098881741b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 13 deletions

View file

@ -221,25 +221,38 @@ class Overview:
def _table(self) -> str | None: def _table(self) -> str | None:
counts = list(self.mw.col.sched.counts()) counts = list(self.mw.col.sched.counts())
tree_counts = self.mw.col.sched.deck_due_tree(
self.mw.col.decks.get_current_id()
)
but = self.mw.button but = self.mw.button
return """ buried_new = tree_counts.new_count - counts[0]
buried_learning = tree_counts.learn_count - counts[1]
buried_review = tree_counts.review_count - counts[2]
buried_label = tr.browsing_buried()
def number_row(title: str, klass: str, count: int, buried_count: int) -> str:
return f"""
<tr>
<td>{title}:</td>
<td>
<b>
<span class={klass}>{count}</span>
<span class=bury-count title="{buried_label}">{buried_count or ""}</span>
</b>
</td>
</tr>
"""
return f"""
<table width=400 cellpadding=5> <table width=400 cellpadding=5>
<tr><td align=center valign=top> <tr><td align=center valign=top>
<table cellspacing=5> <table cellspacing=5>
<tr><td>{}:</td><td><b><span class=new-count>{}</span></b></td></tr> {number_row(tr.actions_new(), "new-count", counts[0], buried_new)}
<tr><td>{}:</td><td><b><span class=learn-count>{}</span></b></td></tr> {number_row(tr.scheduling_learning(), "learn-count", counts[1], buried_learning)}
<tr><td>{}:</td><td><b><span class=review-count>{}</span></b></td></tr> {number_row(tr.studying_to_review(), "review-count", counts[2], buried_review)}
</table> </table>
</td><td align=center> </td><td align=center>
{}</td></tr></table>""".format( {but("study", tr.studying_study_now(), id="study", extra=" autofocus")}</td></tr></table>"""
tr.actions_new(),
counts[0],
tr.scheduling_learning(),
counts[1],
tr.studying_to_review(),
counts[2],
but("study", tr.studying_study_now(), id="study", extra=" autofocus"),
)
_body = """ _body = """
<center> <center>

View file

@ -13,3 +13,17 @@
.zero-count { .zero-count {
color: var(--zero-count); color: var(--zero-count);
} }
.bury-count {
color: var(--disabled);
font-weight: bold;
margin-inline-start: 2px;
&::before {
content: "+";
}
&:empty {
display: none;
}
}