feat(dashboard): needs-attention widget for overdue hutch cleaning/playtime #33

Merged
cpressland merged 1 commit from feat/dashboard-needs-attention into main 2026-09-14 13:01:48 +01:00
Collaborator

Closes #21

Summary

  • Dashboard (/, the app's default page) now leads with a Needs Attention widget listing hutch compartments overdue for cleaning (>7d) or playtime (>14d), reusing the existing STALE_DAYS/PLAY_STALE_DAYS thresholds and staleness logic from the hutches list view so both stay consistent.
  • Compartments with date_cleaned/last_playtime of null (never logged) surface distinctly as "Never cleaned"/"Never played" and sort first, ahead of any dated-but-stale row — nothing logged at all is the most urgent case.
  • Sorted most-overdue-first overall (max of clean/play overdue-days).
  • Empty compartments (no residents) never trigger the playtime flag.
  • Each row links through to /hutches?search=<letter> for quick action (staff/admin see a Manage link).
  • Sidebar nav label renamed Activity Log -> Dashboard; the audit log is now a second section on the same page (still the default/root / route — no routing changes needed, it was already the root).

Verification

No local Postgres available in the sandbox to boot the full app (main.py runs Postgres-only migration DDL on startup), so verified via a throwaway SQLite-backed smoke script exercising _needs_attention() directly against seeded Hutch/Rabbit rows (never-cleaned, overdue-clean, overdue-play, both-overdue, empty-hutch-never-played cases) and rendering dashboard.html through the real Jinja environment:

  • Correct rows selected (4/6 test hutches flagged, empty hutch excluded)
  • Never-logged sorts first, then most-days-overdue
  • Template renders without errors, contains expected occupant names and headings

Open questions from the issue

  • Thresholds are still the existing hardcoded STALE_DAYS=7/PLAY_STALE_DAYS=14 module constants (shared with hutches.py), not yet admin-configurable — left as a follow-up per the issue's open questions.
  • Did not add the hutches-list-view highlight mentioned in the issue as a "consider" item — it already exists there (red/amber-via-red styling + Needs Cleaning/Needs Playtime filter toggles were pre-existing).
Closes #21 ## Summary - Dashboard (`/`, the app's default page) now leads with a **Needs Attention** widget listing hutch compartments overdue for cleaning (>7d) or playtime (>14d), reusing the existing `STALE_DAYS`/`PLAY_STALE_DAYS` thresholds and staleness logic from the hutches list view so both stay consistent. - Compartments with `date_cleaned`/`last_playtime` of `null` (never logged) surface distinctly as "Never cleaned"/"Never played" and sort **first**, ahead of any dated-but-stale row — nothing logged at all is the most urgent case. - Sorted most-overdue-first overall (max of clean/play overdue-days). - Empty compartments (no residents) never trigger the playtime flag. - Each row links through to `/hutches?search=<letter>` for quick action (staff/admin see a Manage link). - Sidebar nav label renamed Activity Log -> Dashboard; the audit log is now a second section on the same page (still the default/root `/` route — no routing changes needed, it was already the root). ## Verification No local Postgres available in the sandbox to boot the full app (main.py runs Postgres-only migration DDL on startup), so verified via a throwaway SQLite-backed smoke script exercising `_needs_attention()` directly against seeded Hutch/Rabbit rows (never-cleaned, overdue-clean, overdue-play, both-overdue, empty-hutch-never-played cases) and rendering `dashboard.html` through the real Jinja environment: - Correct rows selected (4/6 test hutches flagged, empty hutch excluded) - Never-logged sorts first, then most-days-overdue - Template renders without errors, contains expected occupant names and headings ## Open questions from the issue - Thresholds are still the existing hardcoded `STALE_DAYS=7`/`PLAY_STALE_DAYS=14` module constants (shared with hutches.py), not yet admin-configurable — left as a follow-up per the issue's open questions. - Did not add the hutches-list-view highlight mentioned in the issue as a "consider" item — it already exists there (red/amber-via-red styling + Needs Cleaning/Needs Playtime filter toggles were pre-existing).
feat(dashboard): needs-attention widget for overdue hutch cleaning/playtime
All checks were successful
ci / uv-buildah-build-push (push) Successful in 21s
ci / build (push) Successful in 0s
642a320d31
Dashboard (now the app's default / page) surfaces hutch compartments
where date_cleaned is >7d old or last_playtime is >14d old, using the
same STALE_DAYS/PLAY_STALE_DAYS thresholds and staleness logic already
used on the hutches list view. Compartments with a null date (never
logged) surface distinctly as "Never cleaned"/"Never played" and sort
first as the most urgent case. Sorted most-overdue-first overall.
Empty compartments never trigger the playtime flag (no rabbits to play).

Sidebar link renamed Activity Log -> Dashboard to match; the audit log
now lives as a second section on the same page rather than being the
page's sole content.

Closes #21
Author
Collaborator

Screenshots

Captured from a local run of this branch against a throwaway seeded Postgres DB (never available in prod, purely for review).

Dashboard — Needs Attention widget (new default landing page, /)

dashboard

Hutches list (unchanged, shown for reference / consistency check)

hutches

### Screenshots Captured from a local run of this branch against a throwaway seeded Postgres DB (never available in prod, purely for review). **Dashboard — Needs Attention widget (new default landing page, `/`)** ![dashboard](https://git.cpressland.io/attachments/2cc8659d-a265-4d54-aaa3-0f30ab932947) **Hutches list (unchanged, shown for reference / consistency check)** ![hutches](https://git.cpressland.io/attachments/8947760e-3121-47ad-af62-63b64412647a)
cpressland deleted branch feat/dashboard-needs-attention 2026-09-14 13:01:48 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
cpressland/rabbitdb!33
No description provided.