From 2a63b9120e53edf464e84ad2f37002f89f1f3e84 Mon Sep 17 00:00:00 2001 From: jerick Date: Tue, 21 Apr 2026 10:25:49 -0400 Subject: [PATCH] Budget query needs to look for credit for CCs --- src/app/(app)/budgets/page.tsx | 5 ++++- src/app/(app)/dashboard/page.tsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/(app)/budgets/page.tsx b/src/app/(app)/budgets/page.tsx index 2de49f5..6c0ecc5 100644 --- a/src/app/(app)/budgets/page.tsx +++ b/src/app/(app)/budgets/page.tsx @@ -31,7 +31,10 @@ export default async function BudgetsPage({ searchParams }: { searchParams: Sear JOIN "Account" a ON t."accountId" = a.id WHERE a."userId" = ${userId} AND t."budgetId" IS NOT NULL - AND t.type = 'DEBIT' + AND ( + (a.type = 'CREDIT_CARD' AND t.type = 'CREDIT') + OR (a.type != 'CREDIT_CARD' AND t.type = 'DEBIT') + ) AND t.date >= ${start} AND t.date <= ${end} GROUP BY t."budgetId" diff --git a/src/app/(app)/dashboard/page.tsx b/src/app/(app)/dashboard/page.tsx index 3c92947..7b00f0d 100644 --- a/src/app/(app)/dashboard/page.tsx +++ b/src/app/(app)/dashboard/page.tsx @@ -46,7 +46,10 @@ export default async function DashboardPage({ searchParams }: { searchParams: Se JOIN "Account" a ON t."accountId" = a.id WHERE a."userId" = ${userId} AND t."budgetId" IS NOT NULL - AND t.type = 'DEBIT' + AND ( + (a.type = 'CREDIT_CARD' AND t.type = 'CREDIT') + OR (a.type != 'CREDIT_CARD' AND t.type = 'DEBIT') + ) AND t.date >= ${start} AND t.date <= ${end} GROUP BY t."budgetId"