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
This commit is contained in:
parent
83d82f533a
commit
98fd06b8f7
@ -238,7 +238,15 @@ export class DatabaseStorage implements IStorage {
|
|||||||
? sql`hour IS NOT NULL`
|
? sql`hour IS NOT NULL`
|
||||||
: sql`hour IS 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()
|
.select()
|
||||||
.from(networkAnalytics)
|
.from(networkAnalytics)
|
||||||
.where(
|
.where(
|
||||||
@ -249,6 +257,13 @@ export class DatabaseStorage implements IStorage {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
.orderBy(desc(networkAnalytics.date), desc(networkAnalytics.hour));
|
.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<NetworkAnalytics[]> {
|
async getRecentAnalytics(days: number, hourly: boolean = false): Promise<NetworkAnalytics[]> {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user