fix(reports): open the category zoom on the clicked card category, fill its left box #551

Merged
maximus merged 2 commits from issue-548-category-zoom into main 2026-11-17 01:25:37 +00:00

2 commits

Author SHA1 Message Date
le king fu
ef2932ecc1 fix(reports): open the category zoom from a card on the card's month
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 3m22s
A card's increases and decreases compare its reference month to the
month before, but their links only copied the URL: the zoom opened on
the reports period (the year to date by default), never on that month.
A mover's link now carries the month of the snapshot the list shows,
from its first to its last day (period=custom, from, to), with cat and
the other params kept (Max's answer to the review of PR #551).

test: reproduces #548 (a mover's link, the month both pages hand the
lists, the page's box on a leaf and with the subcategories left out)

Refs #548

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:44:38 -05:00
le king fu
1a44788f07 fix(reports): open the category zoom on the clicked card category, fill its left box
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 3m16s
The category zoom now reads the zoomed category from the `cat` query param
written by the report cards' links, and writes it back (replace) when the
selection changes, so a click on a card opens the zoom on that category and
the selector and the URL always agree. Data read for another category is
never shown.

getCategoryZoom sums each direct child over its whole subtree (bounded
recursive CTE), so the donut of a first-level category shows its
subcategories instead of nothing, and returns the key figures of the
period's transactions (count, average, largest, smallest), oriented like the
total and computed in SQL over every row, a split transaction counting once
for its net in the scope. When the donut has no part to draw (a leaf, the
subcategories left out), the box beside the evolution chart shows those
figures; "No data" only when there is no transaction.

test: reproduces #548 (hook mounted on ?cat=, level-1 parts on real SQLite,
leaf metrics, render of the box)

Fixes #548

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 17:13:43 -05:00