feat(dashboard): KPI cards follow the selected period, monthly analysis keeps the reference month #553

Merged
maximus merged 2 commits from issue-549-dashboard-period-kpis into main 2026-11-26 02:25:36 +00:00

2 commits

Author SHA1 Message Date
le king fu
caf7df5cba fix(dashboard): a custom period of exactly one year compares with last year only
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 3m52s
A custom calendar year next to a leap year kept both changes: 2025 against
the 365 days before it (January 2 – December 31, 2024) and against last
year's dates (January 1 – December 31, 2024), two nearly equal figures under
two labels, the case #549 rules out. A period whose next day falls twelve
months after its first day now drops its previous period, as "This year"
and "12 months" do (review 35029 of PR #553). Tests on the calendar years
2024 to 2026, a year starting on March 15, and a range one day short of a
year, which keeps its previous period. The changelogs and the guide name
this case.

Refs #549

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:09:24 -05:00
le king fu
89976cbe7b feat(dashboard): KPI cards follow the selected period, monthly analysis keeps the reference month
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 3m25s
The four KPI cards and the 12-month income vs expenses chart now read the
period of the filter, like the two expense charts, instead of the reference
month (decision of Max, DECISIONS.md 2026-11-14). Each card compares the
period with the previous period of the same length and with the same dates
last year; "This year" and "12 months" keep the last-year change alone,
"All" has none. The reference month only drives the top movers and budget
adherence, gathered under a new "Monthly analysis" subtitle.

- dateRange: computeComparisonRanges, pure (month-end clamping, February 29,
  custom periods by day count, previous dropped when equal to last year's).
- reportService: getIncomeStatement (the months of getMonthlyTrends within
  the exact bounds, added up) and getPeriodKpis; helpers shared with
  getCartesSnapshot, whose output is unchanged.
- useDashboard: one fetch per temporal axis, each with its own fetch id,
  loading flag and error.
- KpiCard: deltaLabels prop, Cartes' labels by default, a null label hides
  its change.
- Texts FR/EN, in-app guide, user guide section 3, README, changelogs and
  architecture.

Fixes #549

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 19:28:51 -05:00