From 98fd06b8f77472a88d5b76776b921104befcf3e8 Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Mon, 24 Nov 2025 09:18:25 +0000 Subject: [PATCH] Add logging to help debug analytics data retrieval Add console logs to the analytics query and results in `server/storage.ts` to aid in debugging data retrieval issues. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: b5db3658-d0e1-4bb3-a767-7d1d7d363003 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/37PFEyl --- server/storage.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/storage.ts b/server/storage.ts index cfe2321..c327229 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -238,7 +238,15 @@ export class DatabaseStorage implements IStorage { ? sql`hour IS NOT NULL` : sql`hour IS NULL`; - return await db + // DEBUG: Log query parameters + console.log('[ANALYTICS QUERY]', { + startDate: startDate.toISOString(), + endDate: endDate.toISOString(), + hourly, + hourCondition: hourly ? 'NOT NULL' : 'NULL' + }); + + const results = await db .select() .from(networkAnalytics) .where( @@ -249,6 +257,13 @@ export class DatabaseStorage implements IStorage { ) ) .orderBy(desc(networkAnalytics.date), desc(networkAnalytics.hour)); + + console.log('[ANALYTICS RESULTS]', results.length, 'records found'); + if (results.length > 0) { + console.log('[ANALYTICS SAMPLE]', results[0]); + } + + return results; } async getRecentAnalytics(days: number, hourly: boolean = false): Promise {