From 7985f6818eb75ad4298c1d96ff4223a3109996b3 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Mon, 4 May 2026 16:58:38 -0300 Subject: [PATCH] Fix analytics fallback count test --- src/app/api/usage/analytics/route.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/api/usage/analytics/route.ts b/src/app/api/usage/analytics/route.ts index e89d9351e2..470f2db235 100644 --- a/src/app/api/usage/analytics/route.ts +++ b/src/app/api/usage/analytics/route.ts @@ -475,13 +475,14 @@ export async function GET(request: Request) { .prepare( ` SELECT - COUNT(*) as total, - SUM(CASE WHEN requested_model IS NOT NULL AND requested_model != '' THEN 1 ELSE 0 END) as with_requested, + SUM(CASE WHEN (combo_name IS NULL OR combo_name = '') THEN 1 ELSE 0 END) as total, + SUM(CASE WHEN requested_model IS NOT NULL AND requested_model != '' AND (combo_name IS NULL OR combo_name = '') THEN 1 ELSE 0 END) as with_requested, SUM(CASE WHEN requested_model IS NOT NULL AND requested_model != '' AND model IS NOT NULL - AND requested_model != model + AND LOWER(requested_model) != LOWER(model) + AND (combo_name IS NULL OR combo_name = '') THEN 1 ELSE 0 END ) as fallbacks FROM call_logs