mirror of
https://github.com/we-promise/sure.git
synced 2026-05-31 16:29:03 +00:00
Balance trajectory rendered every account as "near the top with a gentle wobble" — pink ($1830/30d), orange ($0/30d), blue ($300/30d) all looked nearly identical because each was a positive balance with mild growth, and per-row 0-baseline scaling pushed all lines toward the ceiling. The chart and the "$X last 30d" column on the right were telling completely different stories on the same row. Switch the metric the chart plots: - Data: 31 daily samples (today − 30 … today) of *cumulative inflow* per account, fetched in one `GROUP BY (account_id, date)` over the 30-day window. Each per-account array is a monotonic non-decreasing prefix sum starting at 0. - Scale: per-row, anchored at 0, ceiling = `max(values) × 1.05`. - The chart's rightmost point now equals the "$X last 30d" column value by construction — chart and column tell the same story. - `last_30_money` is read off the cumulative array's last element, no separate aggregation query. Visual shapes after the swap: - Steady-inflow account → smooth diagonal climb - Bumpy/episodic account → step pattern with flat plateaus - No-inflow account → flat line at the bottom, no filled area Removed `balances` query path entirely; trajectory_for is gone.