Goals: Up To Template calculation with negative category balance (#2535)

* 'up to' calculation

* note

* update to last months balance
This commit is contained in:
shall0pass
2024-04-02 10:35:55 -05:00
committed by GitHub
parent 8f634099e2
commit 1dd1c188d6
3 changed files with 9 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ export async function goalsSimple(
limit,
hold,
to_budget,
last_month_balance,
) {
// simple has 'monthly' and/or 'limit' params
if (template.limit != null) {
@@ -25,7 +26,7 @@ export async function goalsSimple(
const monthly = amountToInteger(template.monthly);
increment = monthly;
} else {
increment = limit;
increment = limit - last_month_balance;
}
to_budget += increment;
return { to_budget, errors, limit, limitCheck, hold };

View File

@@ -513,6 +513,7 @@ async function applyCategoryTemplate(
limit,
hold,
to_budget,
last_month_balance,
);
to_budget = goalsReturn.to_budget;
errors = goalsReturn.errors;

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [shall0pass]
---
Goal templates: Allow budgeting to a full category balance when using 'up to' and a negative category rollover balance.