Review breakdown: show each deck's own activity total
Follow-up to the smart-review breakdown: "I only have 2 decks" turned out to
be three deck cards (one clipped at the window edge) and 15 + 13 + 6 = 34
due. The line now carries each deck's activity total next to its due count -
"Due by deck: Sky deck - 15 of 15 - Humanismus - 13 of 15 - ... - 6 of 13" -
so the arithmetic is checkable inline without opening a deck.
groupByDeck returns {label, count, total}; new i18n key review.dueOfTotal
(en + cs). review-test pins the format. Version 0.6.9, SW v91.
This commit is contained in:
parent
1e8606a95b
commit
71c56ad06f
7 changed files with 24 additions and 8 deletions
|
|
@ -846,6 +846,7 @@ const en: Record<string, string> = {
|
|||
"review.due.few": "{n} due",
|
||||
"review.due.many": "{n} due",
|
||||
"review.dueByDeck": "Due by deck: {list}",
|
||||
"review.dueOfTotal": "{due} of {total}",
|
||||
"review.mistakesByDeck": "Mistakes by deck: {list}",
|
||||
"review.moreDecks.one": "+{n} more deck",
|
||||
"review.moreDecks.few": "+{n} more decks",
|
||||
|
|
@ -1852,6 +1853,7 @@ const cs: Record<string, string> = {
|
|||
"review.due.few": "{n} k opakování",
|
||||
"review.due.many": "{n} k opakování",
|
||||
"review.dueByDeck": "K opakování podle sady: {list}",
|
||||
"review.dueOfTotal": "{due} z {total}",
|
||||
"review.mistakesByDeck": "Chyby podle sady: {list}",
|
||||
"review.moreDecks.one": "+{n} další sada",
|
||||
"review.moreDecks.few": "+{n} další sady",
|
||||
|
|
|
|||
|
|
@ -77,11 +77,13 @@ export function mistakeCount(answers: AnswerRecord[], deckId?: string): number {
|
|||
* ("34 due" with two decks on screen) is self-explanatory instead of looking
|
||||
* like the same mistake twice or an item from a deck that was deleted.
|
||||
*/
|
||||
export function groupByDeck(items: ReviewItem[]): { label: string; count: number }[] {
|
||||
const groups = new Map<string, { label: string; count: number }>();
|
||||
/** `total` is the deck's activity count, so "34 due" can be checked against
|
||||
* the decks themselves ("15 of 15 · 13 of 15 · 6 of 13"). */
|
||||
export function groupByDeck(items: ReviewItem[]): { label: string; count: number; total: number }[] {
|
||||
const groups = new Map<string, { label: string; count: number; total: number }>();
|
||||
for (const item of items) {
|
||||
const key = item.deck.id;
|
||||
const group = groups.get(key) ?? { label: item.deck.title, count: 0 };
|
||||
const group = groups.get(key) ?? { label: item.deck.title, count: 0, total: item.deck.activities.length };
|
||||
group.count += 1;
|
||||
groups.set(key, group);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue