Bug: Cleanup script (#1084)

This commit is contained in:
shall0pass
2023-06-01 09:25:00 -05:00
committed by GitHub
parent 8875f6d487
commit 1d301ac78d
2 changed files with 8 additions and 4 deletions

View File

@@ -82,11 +82,9 @@ async function processCleanup(month) {
`budget-${sinkCategory[c].cat.id}`,
);
let categoryId = sinkCategory[c].cat.id;
let weight = sinkCategory[c].temp.filter(w => w.type === 'sink')[0].weight;
let to_budget =
budgeted +
Math.round(
(sinkCategory[c].temp[0].weight / total_weight) * budgetAvailable,
);
budgeted + Math.round((weight / total_weight) * budgetAvailable);
if (c === sinkCategory.length - 1) {
let currentBudgetAvailable = await getSheetValue(sheetName, `to-budget`);
if (to_budget > currentBudgetAvailable) {

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [shall0pass]
---
Fix error if sink/source were defined in same category.