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