From 7a9036caa6a1a0f0b260ca7d9ddb3d11ddd086b3 Mon Sep 17 00:00:00 2001 From: Jakob Wennberg Date: Fri, 4 Sep 2026 17:14:21 +0200 Subject: [PATCH] fix(kontoplan): remove the per-class active counter (#2273) * fix(kontoplan): counter reflects the filtered selection The per-class band row in the chart of accounts always rendered "{active}/{total} aktiva" with total taken from the already-filtered class group. With the "Utan verifikat" filter (#2231) or a search active, that read as "43/43 aktiva": full coverage of a class that was really a subset. A narrowed band now counts what it shows against the unnarrowed class ("12 av 43 visas" / "12 of 43 shown"); an unnarrowed band keeps the active ratio unchanged. Search and the Verifikat filter narrow Mina konton; search narrows the BAS catalog. The K2 toggle is treated as scope rather than a filter, since it defaults from the company's regelverk and would otherwise flip every catalog band for K2 companies without the user touching anything. Fixes #2263 Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_015qgLgdt4mLmha1ZLFMwq1u * fix(kontoplan): remove the per-class active counter The band row in Kontoplan rendered "{active}/{total} aktiva" from the already-filtered class group, so under the Verifikat filter (#2231) or a search it always read "N/N aktiva": full coverage of a class that was really a subset. The reporter asked for the text to go, and the issue offered removal as one of its two fixes. Removing the counter is the fix from first principles: nothing consumes it, the tab chip and the page footer ("Visar N av M konton") already carry the only counts the page needs, and a counter that does not exist cannot drift from the list again. This drops the countLabel parameter from bandRow, the activeCount and activatedCount derivations, and the now-unused chart_of_accounts.active_count_label key in both locales. It also reverts the filtered-mode helper and memo split from the first commit on this branch. Fixes #2263 Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_015qgLgdt4mLmha1ZLFMwq1u --------- Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 --- .../bookkeeping/ChartOfAccountsManager.tsx | 26 ++++--------------- messages/en.json | 1 - messages/sv.json | 1 - 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/components/bookkeeping/ChartOfAccountsManager.tsx b/components/bookkeeping/ChartOfAccountsManager.tsx index 365a64e9..81a79150 100644 --- a/components/bookkeeping/ChartOfAccountsManager.tsx +++ b/components/bookkeeping/ChartOfAccountsManager.tsx @@ -553,11 +553,13 @@ export default function ChartOfAccountsManager() { } // Concept band row (Klass N: label), clickable to fold the class away. + // It carries no per-class counter: the old "{active}/{total} aktiva" was + // derived from the filtered list and read as full coverage under the + // Verifikat filter (#2263). Shown/total lives once, in the page footer. const bandRow = ( cls: number, open: boolean, onToggle: () => void, - countLabel: string, colSpan: number, ) => ( @@ -570,7 +572,6 @@ export default function ChartOfAccountsManager() { > {t('class_heading', { cls, label: classLabel(cls) })} - {countLabel} @@ -717,16 +718,9 @@ export default function ChartOfAccountsManager() { .map(([cls, classAccounts]) => { const classNum = Number(cls) const open = !collapsedMyClasses.has(classNum) || !!searchQuery - const activeCount = classAccounts.filter((a) => a.is_active).length return ( - {bandRow( - classNum, - open, - () => toggleMyClass(classNum), - t('active_count_label', { active: activeCount, total: classAccounts.length }), - 8, - )} + {bandRow(classNum, open, () => toggleMyClass(classNum), 8)} {open && classAccounts.map((account) => ( { const classNum = Number(cls) const open = expandedCatalogClasses.has(classNum) || !!searchQuery - // Row existence alone is not activation: a deactivated - // account is in the chart but not usable, so it must not - // count as active here either. - const activatedCount = classAccounts.filter((a) => a.is_activated && a.is_active).length return ( - {bandRow( - classNum, - open, - () => toggleCatalogClass(classNum), - t('active_count_label', { active: activatedCount, total: classAccounts.length }), - 5, - )} + {bandRow(classNum, open, () => toggleCatalogClass(classNum), 5)} {open && classAccounts.map((account) => (