fix(dashboard): show account card balance as net worth contribution
The card must keep liabilities negative (existing behaviour, covered by deriveAccountMetrics tests); only the asset sign was buggy. Use netWorthContribution instead of the raw balance so loans/credit cards stay negative while a negative asset (e.g. overdrawn checking) is no longer flipped positive.
This commit is contained in:
parent
58354f9778
commit
741c615e2e
|
|
@ -1,4 +1,5 @@
|
|||
import { useLocale } from '@/hooks/use-locale';
|
||||
import { netWorthContribution } from '@/lib/chart-calculations';
|
||||
import { Account, AccountType, Bank } from '@/types/account';
|
||||
import { Category } from '@/types/category';
|
||||
import { formatMonthFromYearMonth } from '@/utils/date';
|
||||
|
|
@ -74,7 +75,10 @@ export function deriveAccountMetrics(
|
|||
date: formatMonthFromYearMonth(point.month as string, locale),
|
||||
value:
|
||||
typeof point[account.id] === 'number'
|
||||
? (point[account.id] as number)
|
||||
? netWorthContribution(
|
||||
account.type,
|
||||
point[account.id] as number,
|
||||
)
|
||||
: 0,
|
||||
investedAmount:
|
||||
investedKey in point
|
||||
|
|
|
|||
Loading…
Reference in New Issue