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
This commit is contained in:
Lauri Vuorela
2024-02-13 20:35:57 +01:00
committed by GitHub
parent 5b65b8f049
commit f7a13a0436
2 changed files with 37 additions and 6 deletions

View File

@@ -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}
/>