feat(dashboard): add a 7-day stats window to the home page #93

Merged
rcsheets merged 1 commit from feat/home-seven-day-window into main 2026-08-03 09:05:40 +00:00
Owner

The home page rolled up one window (last 24 hours), which is too narrow
to see whether review volume or failures are trending. Add a second card
covering the last 7 days alongside it.

The stat block moves into a "statsWindow" template that the page ranges
over, so the handler decides which windows exist and the markup is
written once. Each window's store lookup falls back to zeros on error
independently, so one failed query no longer blanks the whole rollup.

Both windows share the existing StatsSince query and the indexed
review_events.timestamp column; the 7-day figures are cumulative and
include the last 24 hours.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

The home page rolled up one window (last 24 hours), which is too narrow to see whether review volume or failures are trending. Add a second card covering the last 7 days alongside it. The stat block moves into a "statsWindow" template that the page ranges over, so the handler decides which windows exist and the markup is written once. Each window's store lookup falls back to zeros on error independently, so one failed query no longer blanks the whole rollup. Both windows share the existing StatsSince query and the indexed review_events.timestamp column; the 7-day figures are cumulative and include the last 24 hours. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
feat(dashboard): add a 7-day stats window to the home page
All checks were successful
ci / check (pull_request) Successful in 1m15s
3bd748acb4
The home page rolled up one window (last 24 hours), which is too narrow
to see whether review volume or failures are trending. Add a second card
covering the last 7 days alongside it.

The stat block moves into a "statsWindow" template that the page ranges
over, so the handler decides which windows exist and the markup is
written once. Each window's store lookup falls back to zeros on error
independently, so one failed query no longer blanks the whole rollup.

Both windows share the existing StatsSince query and the indexed
review_events.timestamp column; the 7-day figures are cumulative and
include the last 24 hours.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Collaborator

Automated review by pr-reviewer v0.42.1 | Safety Check | Claude Sonnet 5 | tracking id r-70589d-5a2d41
This is an AI-generated review and may contain mistakes.

Status: Completed


⚠️ The primary review (Mistral Small) failed. The review below is from Claude Sonnet 5, which reviewed the same diff.

Verdict: LGTM — The change is a straightforward, well-tested refactor to add a second stats window with independent error fallback, with no security or breaking-change concerns.
Complexity: moderate

Reviewed the diff for obvious bugs, security issues, or accidental commits.

  • The refactor into a statsWindow template + slice looks sound; the handler builds two independent windows and each falls back to zeros on error independently, matching the PR description.
  • Test coverage was added for the new multi-window rendering and ordering.
  • internal/dashboard/user_handlers.go lacks direct handler-level tests, but the rendering logic is covered via home_render_test.go, and this is a low-risk, additive change (no new external inputs, no auth/security-sensitive code paths touched).
  • No secrets, credentials, or unrelated large files are present in the diff.
  • No breaking changes: existing renderHome test helper still works via a thin wrapper, and the template change preserves the original card markup, just wrapped in a named block.

Nothing alarming stands out; this looks like a clean, well-tested UI/handler change.

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.42.1 | Safety Check | Claude Sonnet 5 | tracking id `r-70589d-5a2d41`* *This is an AI-generated review and may contain mistakes.* **Status:** ✅ Completed --- > ⚠️ The primary review (**Mistral Small**) failed. The review below is from **Claude Sonnet 5**, which reviewed the same diff. **✅ Verdict: LGTM** — The change is a straightforward, well-tested refactor to add a second stats window with independent error fallback, with no security or breaking-change concerns. **Complexity:** moderate Reviewed the diff for obvious bugs, security issues, or accidental commits. - The refactor into a `statsWindow` template + slice looks sound; the handler builds two independent windows and each falls back to zeros on error independently, matching the PR description. - Test coverage was added for the new multi-window rendering and ordering. - `internal/dashboard/user_handlers.go` lacks direct handler-level tests, but the rendering logic is covered via `home_render_test.go`, and this is a low-risk, additive change (no new external inputs, no auth/security-sensitive code paths touched). - No secrets, credentials, or unrelated large files are present in the diff. - No breaking changes: existing `renderHome` test helper still works via a thin wrapper, and the template change preserves the original card markup, just wrapped in a named block. Nothing alarming stands out; this looks like a clean, well-tested UI/handler change.
rcsheets deleted branch feat/home-seven-day-window 2026-08-03 09:05:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
brooktrails/pr-reviewer!93
No description provided.