diet-guard/app/lib
Krzysztof kuhy Rudnicki e07284d3e1 Show weekly and monthly average intake on both devices
The calendar already said which individual days went over budget, but not
whether the week as a whole did. A run of small overages reads as four
harmless yellow squares; averaged, it is the thing that actually moves the
needle.

Three rules are load-bearing, and are documented in CLAUDE.md because getting
any of them wrong silently changes what "under budget" means:

- The denominator is logged days, not elapsed days. An unlogged day is not a
  zero-kcal day, and averaging gaps in as zeros would make a badly-tracked
  week look like the best week of the year.
- The yardstick is the mean of the per-day budgets over those same days,
  resolved through BudgetSchedule -- never today's budget, which would
  retroactively reclassify past weeks on every budget edit.
- Today is excluded. A half-logged today drags the mean far enough to flip
  the band, so every period ends at yesterday.

Band boundaries reuse the calendar's own OVER_BUDGET_YELLOW_CEILING by
import rather than by copy, so a period and its days can never disagree
about what "over" means; that constant loses its underscore to say so.

The MCP get_averages tool returns the average and the band but drops the
average budget, keeping the module's existing invariant that the budget
number never leaves this machine. The CLI, the gate and the phone all show
both, since it is hidden from the network, not from the user.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DjJqpcEsaV5WRhPXyxCThd
2026-08-09 14:59:40 +02:00
..
desktop Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00
models Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
screens Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
services Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
ui Make the meal gate usable without a pointer on a 1366x768 screen 2026-07-30 16:21:27 +02:00
widgets Show weekly and monthly average intake on both devices 2026-08-09 14:59:40 +02:00
main.dart Remove unused features; fix reminder false alarms; share all state 2026-07-26 16:39:52 +02:00