Skip to content

Commit 76580ee

Browse files
committed
fix deleted expense included in total stats
1 parent e728303 commit 76580ee

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/server/api/routers/group.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,7 @@ export const groupRouter = createTRPCRouter({
8181
const balances: Record<string, number> = {};
8282

8383
for (const balance of g.group.groupBalances) {
84-
if (balances[balance.currency] === undefined) {
85-
balances[balance.currency] = balance.amount;
86-
} else {
87-
balances[balance.currency] += balance.amount;
88-
}
84+
balances[balance.currency] = (balances[balance.currency] ?? 0) + balance.amount;
8985
}
9086

9187
return {
@@ -234,6 +230,7 @@ export const groupRouter = createTRPCRouter({
234230
},
235231
where: {
236232
groupId: input.groupId,
233+
deletedAt: null,
237234
},
238235
});
239236

0 commit comments

Comments
 (0)