diff --git a/packages/loot-core/src/server/budget/goaltemplates.js b/packages/loot-core/src/server/budget/goaltemplates.js index 3083935296aae1c4d9fc8acab22b1e44c04d4d37..90ce80aa1283dff2e516262548a1025cd868e5aa 100644 --- a/packages/loot-core/src/server/budget/goaltemplates.js +++ b/packages/loot-core/src/server/budget/goaltemplates.js @@ -131,7 +131,6 @@ async function applyCategoryTemplate(category, template_lines, month, force) { let current_month = new Date(`${month}-01`); // remove lines for past dates, calculate repeating dates - let got_by = false; template_lines = template_lines.filter(template => { switch (template.type) { case 'by': @@ -175,29 +174,16 @@ async function applyCategoryTemplate(category, template_lines, month, force) { }); if (template_lines.length > 1) { - template_lines = template_lines - .sort((a, b) => { - if (a.type === 'by' && !a.annual) { - return differenceInCalendarMonths( - new Date(`${a.month}-01`), - new Date(`${b.month}-01`), - ); - } else { - return a.type.localeCompare(b.type); - } - }) - .filter(el => { - if (el.type === 'by') { - if (!got_by) { - got_by = true; - return el; - } else { - return null; - } - } else { - return el; - } - }); + template_lines = template_lines.sort((a, b) => { + if (a.type === 'by' && !a.annual) { + return differenceInCalendarMonths( + new Date(`${a.month}-01`), + new Date(`${b.month}-01`), + ); + } else { + return a.type.localeCompare(b.type); + } + }); } let to_budget = 0; diff --git a/upcoming-release-notes/860.md b/upcoming-release-notes/860.md new file mode 100644 index 0000000000000000000000000000000000000000..d2bc818d97a3d7c2fc7e2a80ed384b4a0922f322 --- /dev/null +++ b/upcoming-release-notes/860.md @@ -0,0 +1,6 @@ +--- +category: Enhancement +authors: [shall0pass] +--- + +Allow goal template 'by' matches to compound \ No newline at end of file