Skip to content

A local-first personal finance app

:bug: fix limit checker (#5835)

youngcwca6d80461a7b
diff --git a/packages/loot-core/src/server/budget/category-template-context.ts b/packages/loot-core/src/server/budget/category-template-context.ts
index 5ffecbd172..3e1701f30b 100644
--- a/packages/loot-core/src/server/budget/category-template-context.ts
+++ b/packages/loot-core/src/server/budget/category-template-context.ts
@@ -434,10 +434,6 @@ export class CategoryTemplateContext {
t.type === 'limit' ||
t.type === 'remainder',
)) {
- if (this.limitCheck) {
- throw new Error('Only one `up to` allowed per category');
- }
-
let limitDef;
if (template.type === 'limit') {
limitDef = template;
@@ -449,6 +445,10 @@ export class CategoryTemplateContext {
}
}
+ if (this.limitCheck) {
+ throw new Error('Only one `up to` allowed per category');
+ }
+
if (limitDef.period === 'daily') {
const numDays = monthUtils.differenceInCalendarDays(
monthUtils.addMonths(this.month, 1),
diff --git a/upcoming-release-notes/5835.md b/upcoming-release-notes/5835.md
new file mode 100644
index 0000000000..1aaba6b682
--- /dev/null
+++ b/upcoming-release-notes/5835.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [youngcw]
+---
+
+Fix template limit checker incorrectly claiming there are multiple limits