Include all asset accounts in Available to Budget
Previously only checked checking+savings; now includes investments and any other non-liability account types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
c1b7dcacb7
commit
f38fceefba
1 file changed
+4
-3
+4
-3
@@ -929,9 +929,10 @@ export default function BudgetDashboard() {
|
|||||||
return e.allocated + incomeAlloc > 0 && e.spent > e.allocated + incomeAlloc;
|
return e.allocated + incomeAlloc > 0 && e.spent > e.allocated + incomeAlloc;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Available to budget = liquid assets (checking + savings) minus total envelope allocations
|
// Available to budget = all asset accounts minus total envelope allocations
|
||||||
|
const LIABILITY_TYPES = ['credit_card', 'mortgage', 'loan'];
|
||||||
const liquidBalance = accounts
|
const liquidBalance = accounts
|
||||||
.filter(a => a.type === 'checking' || a.type === 'savings')
|
.filter(a => !LIABILITY_TYPES.includes(a.type))
|
||||||
.reduce((s, a) => s + a.balance, 0);
|
.reduce((s, a) => s + a.balance, 0);
|
||||||
const totalAllocated = envelopes.reduce((s, e) => s + e.allocated, 0);
|
const totalAllocated = envelopes.reduce((s, e) => s + e.allocated, 0);
|
||||||
const availableToBudget = liquidBalance - totalAllocated;
|
const availableToBudget = liquidBalance - totalAllocated;
|
||||||
@@ -948,7 +949,7 @@ export default function BudgetDashboard() {
|
|||||||
${Math.abs(availableToBudget).toFixed(2)}{availableToBudget < 0 ? ' over' : ''}
|
${Math.abs(availableToBudget).toFixed(2)}{availableToBudget < 0 ? ' over' : ''}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-gray-500 mt-1">
|
<p className="text-xs text-gray-500 mt-1">
|
||||||
${liquidBalance.toFixed(2)} in checking & savings − ${totalAllocated.toFixed(2)} allocated to envelopes
|
${liquidBalance.toFixed(2)} across all accounts − ${totalAllocated.toFixed(2)} allocated to envelopes
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-4xl">{availableToBudget >= 0 ? '💰' : '⚠️'}</div>
|
<div className="text-4xl">{availableToBudget >= 0 ? '💰' : '⚠️'}</div>
|
||||||
|
|||||||
Reference in new issue
Block a user