From 1b46ab699d4d80cc4a749b487e9a3ecf36992501 Mon Sep 17 00:00:00 2001 From: Kelly Date: Wed, 10 Dec 2025 23:25:50 -0700 Subject: [PATCH] fix(national): Show all states count, not filtered "active" states MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Active States" metric was arbitrary and confusing. Changed to show total states count - all states in the system regardless of whether they have data or not. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- backend/src/multi-state/state-query-service.ts | 9 ++------- cannaiq/dist/index.html | 4 ++-- cannaiq/src/pages/NationalDashboard.tsx | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/backend/src/multi-state/state-query-service.ts b/backend/src/multi-state/state-query-service.ts index c353e5af..f6d520fd 100644 --- a/backend/src/multi-state/state-query-service.ts +++ b/backend/src/multi-state/state-query-service.ts @@ -702,15 +702,10 @@ export class StateQueryService { async getNationalSummary(): Promise { const stateMetrics = await this.getAllStateMetrics(); - // Active states = states with at least one dispensary that has products + // Get all states count and aggregate metrics const result = await this.pool.query(` SELECT COUNT(DISTINCT s.code) AS total_states, - COUNT(DISTINCT CASE WHEN EXISTS ( - SELECT 1 FROM dispensaries d - JOIN store_products sp ON sp.dispensary_id = d.id - WHERE d.state = s.code - ) THEN s.code END) AS active_states, (SELECT COUNT(*) FROM dispensaries WHERE state IS NOT NULL) AS total_stores, (SELECT COUNT(*) FROM store_products sp JOIN dispensaries d ON sp.dispensary_id = d.id @@ -728,7 +723,7 @@ export class StateQueryService { return { totalStates: parseInt(data.total_states), - activeStates: parseInt(data.active_states), + activeStates: parseInt(data.total_states), // Same as totalStates - all states shown totalStores: parseInt(data.total_stores), totalProducts: parseInt(data.total_products), totalBrands: parseInt(data.total_brands), diff --git a/cannaiq/dist/index.html b/cannaiq/dist/index.html index ab424826..a407b190 100644 --- a/cannaiq/dist/index.html +++ b/cannaiq/dist/index.html @@ -7,8 +7,8 @@ CannaIQ - Cannabis Menu Intelligence Platform - - + +
diff --git a/cannaiq/src/pages/NationalDashboard.tsx b/cannaiq/src/pages/NationalDashboard.tsx index 81558314..598ad708 100644 --- a/cannaiq/src/pages/NationalDashboard.tsx +++ b/cannaiq/src/pages/NationalDashboard.tsx @@ -301,7 +301,7 @@ export default function NationalDashboard() { <>