Skip to content

Commit

Permalink
fix deleted expense included in total stats
Browse files Browse the repository at this point in the history
  • Loading branch information
KMKoushik committed Nov 1, 2024
1 parent e728303 commit 76580ee
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/server/api/routers/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ export const groupRouter = createTRPCRouter({
const balances: Record<string, number> = {};

for (const balance of g.group.groupBalances) {
if (balances[balance.currency] === undefined) {
balances[balance.currency] = balance.amount;
} else {
balances[balance.currency] += balance.amount;
}
balances[balance.currency] = (balances[balance.currency] ?? 0) + balance.amount;
}

return {
Expand Down Expand Up @@ -234,6 +230,7 @@ export const groupRouter = createTRPCRouter({
},
where: {
groupId: input.groupId,
deletedAt: null,
},
});

Expand Down

0 comments on commit 76580ee

Please sign in to comment.