Skip to content
Snippets Groups Projects
Unverified Commit 601c9aa7 authored by shall0pass's avatar shall0pass Committed by GitHub
Browse files

[End of Month Cleanup] Remove automatic funding of rollover categories (#2409)

* remove automatic funding of rollover categories

* note
parent 3b776091
No related branches found
No related tags found
No related merge requests found
......@@ -118,48 +118,6 @@ async function processCleanup(month: string): Promise<Notification> {
}
}
//fund rollover categories after non-rollover categories
for (let c = 0; c < categories.length; c++) {
const category = categories[c];
const budgetAvailable = await getSheetValue(sheetName, `to-budget`);
const balance = await getSheetValue(sheetName, `leftover-${category.id}`);
const budgeted = await getSheetValue(sheetName, `budget-${category.id}`);
const to_budget = budgeted + Math.abs(balance);
const categoryId = category.id;
let carryover = await db.first(
`SELECT carryover FROM zero_budgets WHERE month = ? and category = ?`,
[db_month, categoryId],
);
if (carryover === null) {
carryover = { carryover: 0 };
}
if (
balance < 0 &&
Math.abs(balance) <= budgetAvailable &&
!category.is_income &&
carryover.carryover === 1
) {
await setBudget({
category: category.id,
month,
amount: to_budget,
});
} else if (
balance < 0 &&
!category.is_income &&
carryover.carryover === 1 &&
Math.abs(balance) > budgetAvailable
) {
await setBudget({
category: category.id,
month,
amount: budgeted + budgetAvailable,
});
}
}
const budgetAvailable = await getSheetValue(sheetName, `to-budget`);
if (budgetAvailable <= 0) {
warnings.push('No funds are available to reallocate.');
......
---
category: Bugfix
authors: [shall0pass]
---
End of month cleanup - revert logic introduced in 2295. Ignore rollover categories.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment