2 Commits

Author SHA1 Message Date
Jose Selesan
d156a2a8a4 fix(analysis): mark sub-inflation growth orange and show 12 inflation months
Reserve red for negative variations across all currency columns and the total row. Show the last 12 months with inflation data plus the trailing months without it, and compute the accumulated inflation and total variation over the same 12-month window. Extend the monthly-last backend window to 15 months.
2026-11-19 15:29:11 -03:00
Jose Selesan
0f62a13246 fix(analysis): compute variation for oldest month in 12-month table
The last row of the monthly variation table (oldest month of the rolling
window) always showed only the inflation value: the window started exactly
at that month, so there was no previous month to compare against, the
variation was null and the currency cells rendered '--' (hiding the prices
too).

- Backend: fetch 13 months (12 displayed + 1 base) so the oldest displayed
  month gets its previous month; bump cache key to monthly-last-v3.
- Backend: fix external fallback filter comparing a full date against a
  month key ('2026-10-14' > '2026-10' is always true), which silently
  dropped the most recent month whenever it was missing from the DB.
  Now filters by month key only.
- Backend: normalize subtractMonths to the 1st of the target month to avoid
  month shifts; skip external quotes without a buy value.
- Frontend: compute variations over the 13 months and render the last 12;
  show the current price when a variation is unavailable so no row is blank.
- Add regression tests for the window size and the external fallback.
2026-10-14 12:05:27 -03:00