Skip to content

Commit

Permalink
🐛 [Goals]: Fix inconsistent schedule amounts (#4265)
Browse files Browse the repository at this point in the history
* remove the balance check

* fix inconsistent schedule amounts

* note, cleanup

* update error

* lint;test
  • Loading branch information
youngcw authored Jan 30, 2025
1 parent 9b59333 commit 64df0e1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 1 addition & 4 deletions packages/loot-core/src/server/budget/categoryTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ export class CategoryTemplate {
break;
}
case 'schedule': {
const budgeted = await getSheetValue(
monthUtils.sheetForMonth(this.month),
`leftover-${this.category.id}`,
);
const budgeted = this.fromLastMonth + toBudget;
const ret = await goalsSchedule(
scheduleFlag,
t,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('checkTemplates', () => {
expected: {
sticky: true,
message: 'There were errors interpreting some templates:',
pre: 'cat1: Schedule “Non-existent Schedule” does not exist',
pre: 'Category 1: Schedule “Non-existent Schedule” does not exist',
},
},
];
Expand Down
4 changes: 2 additions & 2 deletions packages/loot-core/src/server/budget/template-notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ export async function checkTemplates(): Promise<Notification> {
const scheduleNames = schedules.map(({ name }) => name);
const errors: string[] = [];

categoryWithTemplates.forEach(({ id, name, templates }) => {
categoryWithTemplates.forEach(({ name, templates }) => {
templates.forEach(template => {
if (template.type === 'error') {
errors.push(`${name}: ${template.line}`);
} else if (
template.type === 'schedule' &&
!scheduleNames.includes(template.name)
) {
errors.push(`${id}: Schedule “${template.name}” does not exist`);
errors.push(`${name}: Schedule “${template.name}” does not exist`);
}
});
});
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/4265.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [youngcw]
---

Fix schedule templates sometimes budgeting wrong amounts

0 comments on commit 64df0e1

Please sign in to comment.