Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyotogblo authored Feb 1, 2024
2 parents 9a0a87a + 5d4fcfd commit 1f52c90
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/loot-core/src/server/budget/cleanup-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Notification } from '../../client/state-types/notifications';
import * as monthUtils from '../../shared/months';
import * as db from '../db';

import { setBudget, getSheetValue } from './actions';
import { setBudget, getSheetValue, setGoal } from './actions';
import { parse } from './cleanup-template.pegjs';

export function cleanupTemplate({ month }: { month: string }) {
Expand Down Expand Up @@ -35,11 +35,20 @@ async function processCleanup(month: string): Promise<Notification> {
sheetName,
`budget-${category.id}`,
);
const spent = await getSheetValue(
sheetName,
`sum-amount-${category.id}`,
);
await setBudget({
category: category.id,
month,
amount: budgeted - balance,
});
await setGoal({
category: category.id,
month,
goal: -spent,
});
num_sources += 1;
}
if (template.filter(t => t.type === 'sink').length > 0) {
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/2282.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [shall0pass]
---

Cleanup utility: Update goal target after end of month cleanup tool is activated for 'source' categories

0 comments on commit 1f52c90

Please sign in to comment.