Skip to content

Fix trailing 7-day stats and add 14-day totals legend#188

Merged
NickPPC merged 1 commit into
mainfrom
worktree-fix-trailing-7days-stats
May 18, 2026
Merged

Fix trailing 7-day stats and add 14-day totals legend#188
NickPPC merged 1 commit into
mainfrom
worktree-fix-trailing-7days-stats

Conversation

@NickPPC
Copy link
Copy Markdown
Member

@NickPPC NickPPC commented May 18, 2026

Summary

  • Fix the dashboard chart so the "Last 7 days" data is a true rolling 7-day window (orders before now - 7 days are no longer counted, and days with zero orders are no longer silently dropped).
  • Build the chart's day axis deterministically from today's local midnight back through today - 7 days, padding missing days with empty buckets.
  • Add a "Last 14 days" legend rendered side-by-side with the existing "Last 7 days" legend, backed by a new loadRobotTotalsLastNDays helper.

Test plan

  • Load the dashboard; bar chart shows day groups from today - 7 days through today, with empty groups rendered for days with no orders.
  • "Last 7 days" legend tallies only orders inside the rolling 7×24h window (loaded at 11am Monday, an order from last Monday 9:30am is excluded).
  • "Last 14 days" legend appears alongside the 7-day one and shows totals ≥ the 7-day numbers; may include robots that don't appear in the 7-day legend.
  • Robot colors in both legends match the corresponding bar colors.

🤖 Generated with Claude Code

The dashboard's "Last 7 days" chart was querying a 14-day window and
slicing to the 7 most-recent non-empty buckets, so days with zero
orders were dropped and older orders ended up counted in their place.
Switch to a true rolling 7-day window: the MQL $match uses
`time_received >= now - 7d` so an order at 9:30am last Monday is no
longer counted when the page is loaded at 11am this Monday, and the
chart pads missing days from today's local midnight back through
today minus 7.

Add `loadRobotTotalsLastNDays` and render a second legend beside the
chart so the dashboard shows both 7-day and 14-day per-robot totals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NickPPC NickPPC requested a review from cheukt May 18, 2026 18:52
@NickPPC NickPPC merged commit 278985c into main May 18, 2026
3 checks passed
@NickPPC NickPPC deleted the worktree-fix-trailing-7days-stats branch May 18, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant