diff --git a/ts/graphs/CardCounts.svelte b/ts/graphs/CardCounts.svelte index 7835f7e10..3667c8bde 100644 --- a/ts/graphs/CardCounts.svelte +++ b/ts/graphs/CardCounts.svelte @@ -1,4 +1,5 @@ {#if controller} diff --git a/ts/graphs/card-counts.ts b/ts/graphs/card-counts.ts index f45bca720..12b0b7799 100644 --- a/ts/graphs/card-counts.ts +++ b/ts/graphs/card-counts.ts @@ -23,7 +23,7 @@ import type { GraphBounds } from "./graph-helpers"; import { cumsum } from "d3-array"; import type { I18n } from "anki/i18n"; -type Count = [string, number, boolean]; +type Count = [string, number, boolean, string]; export interface GraphData { title: string; counts: Count[]; @@ -86,18 +86,51 @@ function countCards( } } + const extraQuery = separateInactive ? " -(is:buried or is:suspended)" : ""; + const counts: Count[] = [ - [i18n.tr(i18n.TR.STATISTICS_COUNTS_NEW_CARDS), newCards, true], - [i18n.tr(i18n.TR.STATISTICS_COUNTS_LEARNING_CARDS), learn, true], - [i18n.tr(i18n.TR.STATISTICS_COUNTS_RELEARNING_CARDS), relearn, true], - [i18n.tr(i18n.TR.STATISTICS_COUNTS_YOUNG_CARDS), young, true], - [i18n.tr(i18n.TR.STATISTICS_COUNTS_MATURE_CARDS), mature, true], + [ + i18n.tr(i18n.TR.STATISTICS_COUNTS_NEW_CARDS), + newCards, + true, + `is:new${extraQuery}`, + ], + [ + i18n.tr(i18n.TR.STATISTICS_COUNTS_LEARNING_CARDS), + learn, + true, + `(-is:review is:learn)${extraQuery}`, + ], + [ + i18n.tr(i18n.TR.STATISTICS_COUNTS_RELEARNING_CARDS), + relearn, + true, + `(is:review is:learn)${extraQuery}`, + ], + [ + i18n.tr(i18n.TR.STATISTICS_COUNTS_YOUNG_CARDS), + young, + true, + `(is:review -is:learn) prop:ivl<21${extraQuery}`, + ], + [ + i18n.tr(i18n.TR.STATISTICS_COUNTS_MATURE_CARDS), + mature, + true, + `(is:review -is:learn) prop:ivl>=21${extraQuery}`, + ], [ i18n.tr(i18n.TR.STATISTICS_COUNTS_SUSPENDED_CARDS), suspended, separateInactive, + "is:suspended", + ], + [ + i18n.tr(i18n.TR.STATISTICS_COUNTS_BURIED_CARDS), + buried, + separateInactive, + "is:buried", ], - [i18n.tr(i18n.TR.STATISTICS_COUNTS_BURIED_CARDS), buried, separateInactive], ]; return counts; @@ -132,6 +165,7 @@ export interface SummedDatum { count: number; // show up in the table show: boolean; + query: string; // running total total: number; } @@ -139,6 +173,7 @@ export interface SummedDatum { export interface TableDatum { label: string; count: number; + query: string; percent: string; colour: string; } @@ -155,6 +190,7 @@ export function renderCards( label: count[0], count: count[1], show: count[2], + query: count[3], idx, total: n, } as SummedDatum; @@ -205,6 +241,7 @@ export function renderCards( count: d.count, percent: `${percent}%`, colour: barColours[idx], + query: d.query, } as TableDatum) : []; });