fix(stats): count mined cards once and keep lexical stats exact after deletes

- Card creation now owns mined-card counting; remove the outer single and
  multi-line mining increments that double counted each card.
- Preserve fractional first_seen/last_seen precision when session deletes
  compare and refresh lexical aggregates.
- Derive vocabulary_visible from the stored word row on every write so the
  new-word charts agree with the filtered vocabulary summary.
- Bump the lexical rollup version so existing databases re-derive visibility
  and repair stale last_seen values once in the background worker.
This commit is contained in:
sudacode committed 2026-10-01 22:56:38 -07:00
1 parent a5d0b63792
commit 4677f5624b
18 files changed
+213 -114

No files matched your search

@@ -57,7 +57,6 @@ export function createBuildHandleMineSentenceDigitMainDepsHandler<
getCurrentSecondarySubText: () => string | undefined;
showMpvOsd: (text: string) => void;
logError: (message: string, err: unknown) => void;
onCardsMined: (count: number) => void;
handleMineSentenceDigitCore: (
count: number,
options: {
@@ -66,7 +65,6 @@ export function createBuildHandleMineSentenceDigitMainDepsHandler<
getCurrentSecondarySubText: () => string | undefined;
showMpvOsd: (text: string) => void;
logError: (message: string, err: unknown) => void;
onCardsMined: (count: number) => void;
},
) => void;
}) {
@@ -76,7 +74,6 @@ export function createBuildHandleMineSentenceDigitMainDepsHandler<
getCurrentSecondarySubText: () => deps.getCurrentSecondarySubText(),
showMpvOsd: (text: string) => deps.showMpvOsd(text),
logError: (message: string, err: unknown) => deps.logError(message, err),
onCardsMined: (count: number) => deps.onCardsMined(count),
handleMineSentenceDigitCore: (
count: number,
options: {
@@ -85,7 +82,6 @@ export function createBuildHandleMineSentenceDigitMainDepsHandler<
getCurrentSecondarySubText: () => string | undefined;
showMpvOsd: (text: string) => void;
logError: (message: string, err: unknown) => void;
onCardsMined: (count: number) => void;
},
) => deps.handleMineSentenceDigitCore(count, options),
});