From 54f9b712e4a31e235c8c7fb2ffeb390d5c8d1d1c Mon Sep 17 00:00:00 2001 From: youngcw <calebyoung94@gmail.com> Date: Sat, 13 May 2023 05:36:00 -0700 Subject: [PATCH] Fix infinite loop in repeat goal (#1019) I believe I found the infinite loop problem in the repeat goal. This doesn't mess things up if you are budgeting the same month that the goal starts, that's probably why we didn't see it before. Side note: The logic always starts at the start date in the template, then increments until falling in the right month window. If this template gets used for, say, a few years, it will start to bog down the processing. If someone has a good quick fix I can add that. --- packages/loot-core/src/server/budget/goaltemplates.ts | 2 +- upcoming-release-notes/1019.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 upcoming-release-notes/1019.md diff --git a/packages/loot-core/src/server/budget/goaltemplates.ts b/packages/loot-core/src/server/budget/goaltemplates.ts index 6ac4fd586..992acae7a 100644 --- a/packages/loot-core/src/server/budget/goaltemplates.ts +++ b/packages/loot-core/src/server/budget/goaltemplates.ts @@ -398,8 +398,8 @@ async function applyCategoryTemplate( if (budgetAvailable > 0) to_budget += budgetAvailable; errors.push(`Insufficient funds.`); } - w = addWeeks(w, weeks); } + w = addWeeks(w, weeks); } break; } diff --git a/upcoming-release-notes/1019.md b/upcoming-release-notes/1019.md new file mode 100644 index 000000000..4f47f0351 --- /dev/null +++ b/upcoming-release-notes/1019.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [youngcw] +--- + +Fix infinite loop condition in repeat goal -- GitLab