diff options
| author | Sebastien Castiel <sebastien@castiel.me> | 2023-12-06 20:30:41 -0500 |
|---|---|---|
| committer | Sebastien Castiel <sebastien@castiel.me> | 2023-12-06 20:30:41 -0500 |
| commit | ae7360caf8be551979759084c3b66677a75bcf00 (patch) | |
| tree | ae23da7f89718105180eb9e0900acbb9263852eb /src/lib | |
| parent | 57899b0160385c53df4e43ef2fd12492e0dffb77 (diff) | |
Fix balances display
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/balances.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/balances.ts b/src/lib/balances.ts index a53bd01..20a83fb 100644 --- a/src/lib/balances.ts +++ b/src/lib/balances.ts @@ -50,9 +50,9 @@ function divide(total: number, count: number, isLast: boolean): number { export function getSuggestedReimbursements( balances: Balances, ): Reimbursement[] { - const balancesArray = Object.entries(balances).map( - ([participantId, { total }]) => ({ participantId, total }), - ) + const balancesArray = Object.entries(balances) + .map(([participantId, { total }]) => ({ participantId, total })) + .filter((b) => b.total !== 0) balancesArray.sort((b1, b2) => b2.total - b1.total) const reimbursements: Reimbursement[] = [] while (balancesArray.length > 1) { |
