From 78ee5fdf48ce4edc438beb42dbc5e5afdb77d215 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Fri, 11 Sep 2026 22:23:33 -0400 Subject: [PATCH] Exclude Closed tickets from the dashboard status breakdown chart (#110) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit StatsModel::getAllStats()'s by_status breakdown grouped every status including Closed, unlike by_priority and by_category which already filter status != 'Closed'. Closed tickets accumulate indefinitely, so over time the status donut chart's Closed slice comes to dominate it, squeezing Open/Pending/In Progress down to barely-visible slivers — exactly the breakdown the chart exists to show at a glance. Filtered by_status the same way the other two breakdowns already are. The separate open_tickets/closed_tickets KPI counts are unaffected (a different query); Closed just no longer appears as a chart segment. Note: this issue was labeled 'invalid' with no explanation in the body or comments — checked and it's Gitea's generic stock label (description "Something is wrong"), not a documented decision that the request itself was wrong. The described problem is real and reproducible in the code, so implementing it as filed. Verified against real MariaDB: seeded 3 open-ish tickets (Open, Pending, In Progress) and 3 Closed. by_status now returns only the 3 active statuses; open_tickets/closed_tickets KPI counts are unchanged at 3/3. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_0117oBw2jN4kALYeS8HPq4zV --- models/StatsModel.php | 2 +- views/DashboardView.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/models/StatsModel.php b/models/StatsModel.php index e1fd602..5595794 100644 --- a/models/StatsModel.php +++ b/models/StatsModel.php @@ -148,7 +148,7 @@ class StatsModel FROM tickets t WHERE status != 'Closed' AND ($visSQL) GROUP BY priority UNION ALL SELECT 'status' as type, status as label, COUNT(*) as count - FROM tickets t WHERE ($visSQL) GROUP BY status + FROM tickets t WHERE status != 'Closed' AND ($visSQL) GROUP BY status UNION ALL SELECT 'category' as type, category as label, COUNT(*) as count FROM tickets t WHERE status != 'Closed' AND ($visSQL) GROUP BY category"; diff --git a/views/DashboardView.php b/views/DashboardView.php index 4417744..76bc636 100644 --- a/views/DashboardView.php +++ b/views/DashboardView.php @@ -280,8 +280,11 @@ include __DIR__ . '/layout_header.php'; // default: with no `status` param the controller falls back to the viewer's // default_status_filters preference, which can be anything, so the resulting // list would not necessarily match what the chart counted. StatsModel builds - // by_priority and by_category with `status != 'Closed'`, while by_status spans - // every status — so only the priority and category charts pin the open set. + // by_priority, by_status, and by_category all with `status != 'Closed'` — + // closed tickets accumulate indefinitely and would otherwise dominate every + // breakdown over time — so chartPriority/chartCategory pin the open set + // explicitly, while chartStatus's clicked label is itself already one of + // the non-Closed statuses. function openStatuses() { var all = window.TICKET_STATUSES || ['Open', 'Pending', 'In Progress', 'Closed']; return all.filter(function(s) { return s !== 'Closed'; }).join(',');