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

[Enhancement] Goal Target with cleanup template (#2282)

* update goal target after montly cleanup

* release note
parent 54d7e546
No related branches found
No related tags found
No related merge requests found
......@@ -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 }) {
......@@ -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) {
......
---
category: Enhancements
authors: [shall0pass]
---
Cleanup utility: Update goal target after end of month cleanup tool is activated for 'source' 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