aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/groups
diff options
context:
space:
mode:
authorLauri Vuorela <lauri.vuorela@gmail.com>2024-02-13 20:35:57 +0100
committerGitHub <noreply@github.com>2024-02-13 14:35:57 -0500
commitf7a13a0436badbf46be38c5b578b8543c7743d07 (patch)
tree186c7808e89e4587101c1920eee9c96a94031abd /src/app/groups
parent5b65b8f049443ee8b95ce101d894df411676f51b (diff)
Round totals rather than expense by expense (#88)
* do balance rounding only on full balances rather than on every expense * use "public balances" calculated from reimbursements to show on balance page * fixes for totals that did not work as expected * prettier
Diffstat (limited to 'src/app/groups')
-rw-r--r--src/app/groups/[groupId]/balances/page.tsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/app/groups/[groupId]/balances/page.tsx b/src/app/groups/[groupId]/balances/page.tsx
index b35a379..93223a4 100644
--- a/src/app/groups/[groupId]/balances/page.tsx
+++ b/src/app/groups/[groupId]/balances/page.tsx
@@ -9,7 +9,11 @@ import {
CardTitle,
} from '@/components/ui/card'
import { getGroupExpenses } from '@/lib/api'
-import { getBalances, getSuggestedReimbursements } from '@/lib/balances'
+import {
+ getBalances,
+ getPublicBalances,
+ getSuggestedReimbursements,
+} from '@/lib/balances'
import { Metadata } from 'next'
import { notFound } from 'next/navigation'
@@ -28,6 +32,7 @@ export default async function GroupPage({
const expenses = await getGroupExpenses(groupId)
const balances = getBalances(expenses)
const reimbursements = getSuggestedReimbursements(balances)
+ const publicBalances = getPublicBalances(reimbursements)
return (
<>
@@ -40,7 +45,7 @@ export default async function GroupPage({
</CardHeader>
<CardContent>
<BalancesList
- balances={balances}
+ balances={publicBalances}
participants={group.participants}
currency={group.currency}
/>