Budget query needs to look for credit for CCs
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user