Highlights: default reference month to previous + YTD current year, user-changeable (#106) #111
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#111
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-106-highlights-default-ref-month"
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
/reports/highlightsnow defaults the monthly tiles (current-month balance + top movers vs. previous month) to the previous calendar month instead of the current one — matching Cartes and Compare.CompareReferenceMonthPickeron the page lets the user pivot both the monthly balance tile and the top-movers comparison to any past month. Selection persists in the URL via?refY=YYYY&refM=MM(bookmarkable, distinct from?from/?towhich govern YTD in other reports)./reportsinherits the same default viauseHighlights.defaultReferencePeriod(today)extracted tosrc/utils/referencePeriod.tsand adopted byuseCartesanduseCompare.Signature changes
getHighlights(referenceYear, referenceMonth, ytdYear, windowDays?, topMoversLimit?, topTransactionsLimit?, today?)— replaces the previous(windowDays, referenceDate, ...)shape.todayis injected for deterministic unit tests.useHighlights()now returns{ year, month, ytdYear, setReferencePeriod, ... }in addition to the previousdata/isLoading/error/windowDays/setWindowDays.Test plan
npm test -- --run— 14 suites, 121 tests pass (including the 6 updatedgetHighlightstests + 6 newresolveHighlightsReferencetests + 3 newdefaultReferencePeriodtests)npm run build— tsc + vite build cleancargo checkpasses/reports/highlightsin April — monthly tile + top-movers should show March data by default; YTD should sum Jan 1 → today?refY=2025&refM=11, monthly tile shows Nov 2025 balance, YTD tile does NOT change?refY/?refM, open in a new tab — same reference month preselected🤖 Generated with Claude Code
Revue — APPROVE ✅
Verdict
Implementation propre et bien testée. Les défauts demandés sont respectés et l'URL reste bookmarkable.
Points validés
defaultReferencePeriodextrait danssrc/utils/referencePeriod.tsavec test dédié. Réutilisé paruseCartesetuseCompare(alias local conservé). Bonne dé-duplication.?refY=YYYY&refM=MM— distincts defrom/to, donc pas de conflit avec les autres rapports. Fallback clean versdefaultReferencePeriod()si absents ou malformés.new Date().getFullYear()), indépendant de la référence choisie par l'utilisateur. Correspond à ce que demande l'issue.today(pas sur la fin du mois de référence) — comportement conservé, mentionné dans les notes.todaydansgetHighlightspour des tests déterministes. Bonne pratique.CompareReferenceMonthPickerbranché à côté duPeriodSelectordansReportsHighlightsPage.HubHighlightsPanel:useHighlightsremplit automatiquement avec le bon défaut → le hub preview matche la page détail sans code supplémentaire.monthEndmort supprimé (nettoyage).useHighlights,referencePeriod, mise à jour complète dereportService.test.ts.Vérifications locales
npm test -- --run: 121/121 verts (10 nouveaux tests)npm run build: ✅ (5.28s)Label hygiene
L'issue #106 portait à la fois
status:readyetstatus:reviewaprès l'update de l'Agent — j'ai retiré lestatus:readyrésiduel. Pattern à surveiller pour les prochains sprints.Rien ne bloque le merge. Dernière PR du milestone
spec-refonte-rapports🎉