refactor: compare report — Actual-vs-actual mode with reference month picker (#96) #98
No reviewers
Labels
No labels
source:analyste
source:defenseur
source:human
source:medic
status:approved
status:blocked
status:in-progress
status:needs-fix
status:ready
status:review
status:triage
type:bug
type:feature
type:infra
type:refactor
type:schema
type:security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: maximus/Simpl-Resultat#98
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-96-compare-refactor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Actual vs actual+Actual vs budget. The actual-vs-actual view exposes an explicit reference-month dropdown in the header (defaults to the previous month, wraps around January) and a MoM ↔ YoY sub-toggle.BarChart— two bars per category (reference period vs comparison period) — so both values are visible at a glance instead of only the delta.PeriodSelectorstays in sync with the reference month picker: navigating via the dropdown or the period selector both update the underlying reference year/month.previousMonth(),defaultReferencePeriod(),comparisonMeta()extracted fromuseCompareand covered by 9 new vitest cases (January wrap-around for both MoM and YoY, default reference period from an arbitrary "today", month/year arithmetic).reportService.tsis unchanged —getCompareMonthOverMonth(year, month)andgetCompareYearOverYear(year)already accepted the right parameters.Test plan
npm run build— green (tsc + vite)npm test— 71/71 vitest cases passing (9 new inuseCompare.test.ts)BudgetVsActualTablecorrectlyPeriodSelector(e.g. "Last 12 months") still updates the reference monthCloses #96
Collapse the three Compare tabs (MoM / YoY / Budget) into two modes. The new "Actual vs actual" mode exposes an explicit reference-month dropdown in the header (defaults to the previous month, wraps around January) and a MoM/YoY sub-toggle. The chart is rewritten to a grouped side-by-side BarChart with two bars per category (reference period vs comparison period) so both values are visible at a glance instead of just the delta. The URL PeriodSelector stays in sync with the reference month. - useCompare: state splits into { mode: "actual"|"budget", subMode: "mom"|"yoy", year, month }. Pure helpers previousMonth(), defaultReferencePeriod(), comparisonMeta() extracted for tests - CompareModeTabs: 2 modes instead of 3 - New CompareSubModeToggle and CompareReferenceMonthPicker components - ComparePeriodChart: grouped bars via two <Bar dataKey="..."/> on a vertical BarChart - i18n: modeActual / subModeMoM / subModeYoY / referenceMonth (FR+EN), retire modeMoM / modeYoY - 9 new vitest cases covering the pure helpers (January wrap-around for both MoM and YoY, default reference period, month/year arithmetic) Closes #96 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>