From 53ba27370dbd462ee1d6645faa9e8202577ed7c3 Mon Sep 17 00:00:00 2001 From: NguyenND Date: Thu, 9 Jul 2026 12:12:07 -0400 Subject: [PATCH] Jul 9 - Update Dashboard separate open issue by Handled by --- CLAUDE.md | 2 +- app/routes/dashboard.py | 7 +++++++ app/templates/dashboard.html | 36 ++++++++++++++++++++++++++++-------- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5d95527..8a0fccc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1029,7 +1029,7 @@ The dashboard cards are organised into two labelled sections separated by a divi 4. Pending Follow-ups — inspections with `follow_up_required=True`; links to `inspections.index?status=follow_up` **Issues section** (customers see first 3; staff see all 5): -1. Open Issues — `status=open` with severity breakdown badges +1. Open Issues — `status=open` with severity breakdown badges (C/H/M/L) **and** a "Handled by" split (Janitorial Staff / Facility Staff / External Vendor) from `handler_breakdown`; each handler chip links to `issues.index?status=open&handler_type=...`. Both breakdowns are derived from the already-loaded `open_issues_all` list (no extra queries). The card is no longer a single wrapping anchor — the count and each handler chip are separate links (nested anchors are invalid). 2. Issues Opened Today — links to `issues.index` with `date_from=today&date_to=today` (uses the date filter added to `issues.index`) 3. Resolved Today — `status=resolved` + today's date range 4. Pending Verification — `status=pending_verification` diff --git a/app/routes/dashboard.py b/app/routes/dashboard.py index a280a1d..f7a8091 100644 --- a/app/routes/dashboard.py +++ b/app/routes/dashboard.py @@ -95,6 +95,12 @@ def index(): 'medium': sum(1 for i in open_issues_all if i.severity == 'medium'), 'low': sum(1 for i in open_issues_all if i.severity == 'low'), } + # Open issues split by who handles them (phase35) — same list, no extra query. + handler_breakdown = { + 'internal': sum(1 for i in open_issues_all if (i.handler_type or 'internal') == 'internal'), + 'facility': sum(1 for i in open_issues_all if i.handler_type == 'facility'), + 'vendor': sum(1 for i in open_issues_all if i.handler_type == 'vendor'), + } # ── Issues resolved today ───────────────────────────────────────────────── resolved_today_q = Issue.query.filter( @@ -362,6 +368,7 @@ def index(): completed_today = completed_today, open_issues = open_issues, severity_breakdown = severity_breakdown, + handler_breakdown = handler_breakdown, resolved_today = resolved_today, pending_followups = pending_followups, issues_opened_today = issues_opened_today, diff --git a/app/templates/dashboard.html b/app/templates/dashboard.html index b266431..05a1f9e 100644 --- a/app/templates/dashboard.html +++ b/app/templates/dashboard.html @@ -139,26 +139,46 @@
-
Open Issues
-
{{ open_issues }}
-
- Active issues not yet resolved - {% if open_issues > 0 %} - · {% if severity_breakdown.critical > 0 %}{{ severity_breakdown.critical }}C {% endif %} + +
{{ open_issues }}
+
+ {% if open_issues > 0 %} +
+ {% if severity_breakdown.critical > 0 %}{{ severity_breakdown.critical }}C {% endif %} {% if severity_breakdown.high > 0 %}{{ severity_breakdown.high }}H {% endif %} {% if severity_breakdown.medium > 0 %}{{ severity_breakdown.medium }}M {% endif %} {% if severity_breakdown.low > 0 %}{{ severity_breakdown.low }}L{% endif %} - {% endif %}
+ {# ── Split by who handles it (click to drill in) ── #} +
+ Handled by: + {% if handler_breakdown.internal > 0 %} + + {{ handler_breakdown.internal }} + {% endif %} + {% if handler_breakdown.facility > 0 %} + + {{ handler_breakdown.facility }} + {% endif %} + {% if handler_breakdown.vendor > 0 %} + + {{ handler_breakdown.vendor }} + {% endif %} +
+ {% else %} +
Active issues not yet resolved
+ {% endif %}
-