From 6f00d9fe3ed686549432eecc1c29afb5b48bef90 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Tue, 23 Sep 2025 14:30:05 +0000 Subject: [PATCH] Fix issue with reconciled task count in statistics module Adjusted SQL query in DatabaseStorage.ts to correctly count reconciled tasks by removing the `OR reconciled = 1` condition, ensuring accurate data in the statistics module. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/jnL5Pt5 --- server/storage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/storage.ts b/server/storage.ts index e5b86f3..a071a15 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -2907,7 +2907,7 @@ export class DatabaseStorage implements IStorage { const deliveryQuery = db.select({ count: sql`COUNT(*)`, totalAmount: sql`COALESCE(SUM(CAST(bl_amount AS NUMERIC)), 0) + COALESCE(SUM(CAST(invoice_amount AS NUMERIC)), 0)`, - reconciled: sql`COUNT(CASE WHEN reconciled = true OR reconciled = 1 THEN 1 END)`, + reconciled: sql`COUNT(CASE WHEN reconciled = true THEN 1 END)`, avgDelay: sql`AVG(EXTRACT(EPOCH FROM (delivered_date - scheduled_date)) / 86400)` // days }).from(deliveries); if (deliveryConditions.length) deliveryQuery.where(and(...deliveryConditions));