From 15412a178ffdc304e8259be2b318b11f2a1b4a05 Mon Sep 17 00:00:00 2001 From: David Saltares Date: Tue, 1 Oct 2024 09:51:21 +0200 Subject: [PATCH] fix: account balance not updating correctly --- src/scripts/generateDemoData.ts | 1 + src/server/transactions/utils.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/scripts/generateDemoData.ts b/src/scripts/generateDemoData.ts index d86f658..fdbb786 100644 --- a/src/scripts/generateDemoData.ts +++ b/src/scripts/generateDemoData.ts @@ -505,6 +505,7 @@ async function updateAccountBalance(accountId: number) { .selectFrom('accountTransaction') .select('amount') .where('accountId', '=', accountId) + .where('deletedAt', 'is', null) .execute(); return db .updateTable('bankAccount') diff --git a/src/server/transactions/utils.ts b/src/server/transactions/utils.ts index e4ff3e0..5d42da7 100644 --- a/src/server/transactions/utils.ts +++ b/src/server/transactions/utils.ts @@ -21,6 +21,7 @@ export async function updateAccountBalance(accountId: number) { .selectFrom('accountTransaction') .select('amount') .where('accountId', '=', accountId) + .where('deletedAt', 'is', null) .execute(); return db .updateTable('bankAccount')