Surface the "not_available" balance-check reason too, not just "fail"

The mismatch note only handled outcome === 'fail'. A statement with no
typed or auto-detected balance at all returns "not_available" instead,
which was left just as silently grey as "fail" used to be before the
last fix.
This commit is contained in:
JasonFraser 2026-10-12 07:41:48 -04:00
parent 92979f7de7
commit 37fdd0f235
2 changed files with 24 additions and 2 deletions

View File

@ -602,6 +602,21 @@ restructure; the behavior itself predates it and is unchanged:
the original vanilla-JS implementation closely before the Vue rewrite, and reproduced
deliberately rather than "fixed" as an inconsistency (see `TransactionsTable.vue`'s own
comment).
- An explicit "Recheck Balance" button (`TransactionsTable.vue`) re-runs just the checks
(via `/api/recheck`, no re-extraction) against whichever balance values are currently
*effective* — `extractionStore.effectiveOpeningBalance`/`effectiveClosingBalance`: the
typed input if non-blank, else that frozen original `opening_balance`/`closing_balance`
from the initial extraction — so clearing a typed value and clicking Recheck restores
the statement's own original figures, same check as the first run. Added so a user who
forgot to type a balance before Extract can still run the full check afterward (typing
alone was never wired to a recheck, same as the original vanilla-JS version — only a row
Save or Download triggered one). Below the fields, an `error-note` surfaces the check's
own `detail` text whenever the outcome isn't "pass": a leading "Balance doesn't match the
statement — " prefix for "fail" (its own detail is just the raw math), no prefix for
"not_available" (its detail — "No opening and/or closing balance available..." — already
reads as a complete sentence) — both outcomes used to leave the readout silently grey with
no explanation; "not_available"'s case was only noticed and fixed 2026-10-12, after "fail"
already had it.
- Per-row edit lock (`TransactionRow.vue`/`useRowEditing.js`): cells are read-only until
that row's pencil icon is clicked (pencil rendered in the blue accent color, fixed
2026-10-11 — it was the default muted gray, inconsistent with the Save button's own blue);

View File

@ -50,10 +50,17 @@ const toggleLabel = computed(() => (uiStore.pdfColHidden ? 'Show Source Doc' : '
// that client-side) right under the fields where the mismatch is
// actually visible, instead of leaving the user to find the same line
// in the (collapsed-by-default) checks list elsewhere on the page.
// Also covers "not_available" (neither a typed nor an auto-detected
// balance exists at all) - that outcome has its own explanatory detail
// text too and was previously left just as silent as "fail" used to be.
const balanceMismatchText = computed(() => {
const check = balanceCheck.value
return check?.outcome === 'fail' ? check.detail : ''
return check?.outcome === 'fail' || check?.outcome === 'not_available' ? check.detail : ''
})
// "fail" gets a leading "Balance doesn't match the statement —" since the
// detail text itself is just the raw math; "not_available"'s own detail
// text already reads as a complete sentence, so it needs no prefix.
const balanceMismatchPrefix = computed(() => (balanceCheck.value?.outcome === 'fail' ? "Balance doesn't match the statement — " : ''))
// ── Balance recheck ──────────────────────────────────────────────────
// Entering opening/closing balance AFTER extraction (e.g. the user
@ -108,7 +115,7 @@ async function handleRecheck() {
{{ rechecking ? 'Checking…' : 'Recheck Balance' }}
</button>
</div>
<div v-if="balanceMismatchText" class="error-note visible">Balance doesn't match the statement — {{ balanceMismatchText }}</div>
<div v-if="balanceMismatchText" class="error-note visible">{{ balanceMismatchPrefix }}{{ balanceMismatchText }}</div>
<div class="note">This statement format may not print a clean opening/closing balance — enter them here to run the full statement balance check; otherwise it's marked "not available" rather than guessed.</div>
<div v-if="result" class="note">Click the pencil on a row to edit it, then Save to commit - edits are saved to this browser as you confirm them, row by row.</div>