From fbfee5ba603c9206cceda5e7a270f51551f75b53 Mon Sep 17 00:00:00 2001 From: shall0pass <20625555+shall0pass@users.noreply.github.com> Date: Sun, 28 Jan 2024 12:18:55 -0600 Subject: [PATCH] allow partial fills of non-rollover --- .../loot-core/src/server/budget/cleanup-template.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/loot-core/src/server/budget/cleanup-template.ts b/packages/loot-core/src/server/budget/cleanup-template.ts index 84e94a16fd3..d3c65af3485 100644 --- a/packages/loot-core/src/server/budget/cleanup-template.ts +++ b/packages/loot-core/src/server/budget/cleanup-template.ts @@ -94,6 +94,17 @@ async function processCleanup(month: string): Promise { month, amount: to_budget, }); + } else if ( + balance < 0 && + !category.is_income && + carryover.carryover === 0 && + Math.abs(balance) > budgetAvailable + ) { + await setBudget({ + category: category.id, + month, + amount: budgeted + budgetAvailable, + }); } } const budgetAvailable = await getSheetValue(sheetName, `to-budget`); @@ -130,7 +141,7 @@ async function processCleanup(month: string): Promise { balance < 0 && !category.is_income && carryover.carryover === 1 && - Math.abs(balance) >= budgetAvailable + Math.abs(balance) > budgetAvailable ) { await setBudget({ category: category.id,