mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
[Bugfix] Goals: Fix Schedule Infinite loop (#1917)
* logic * release note
This commit is contained in:
@@ -74,11 +74,23 @@ export async function goalsSchedule(
|
||||
);
|
||||
while (next_date < next_month) {
|
||||
monthlyTarget += -target;
|
||||
let current_date = next_date;
|
||||
next_date = monthUtils.addDays(next_date, 1);
|
||||
next_date = getNextDate(
|
||||
dateConditions,
|
||||
monthUtils._parse(next_date),
|
||||
);
|
||||
let diffDays = monthUtils.differenceInCalendarDays(
|
||||
next_date,
|
||||
current_date,
|
||||
);
|
||||
if (!diffDays) {
|
||||
next_date = monthUtils.addDays(next_date, 3);
|
||||
next_date = getNextDate(
|
||||
dateConditions,
|
||||
monthUtils._parse(next_date),
|
||||
);
|
||||
}
|
||||
}
|
||||
t[ll].target = -monthlyTarget;
|
||||
totalScheduledGoal += target;
|
||||
|
||||
@@ -137,6 +137,13 @@ export function differenceInCalendarMonths(
|
||||
return d.differenceInCalendarMonths(_parse(month1), _parse(month2));
|
||||
}
|
||||
|
||||
export function differenceInCalendarDays(
|
||||
month1: DateLike,
|
||||
month2: DateLike,
|
||||
): number {
|
||||
return d.differenceInCalendarDays(_parse(month1), _parse(month2));
|
||||
}
|
||||
|
||||
export function subMonths(month: string | Date, n: number) {
|
||||
return d.format(d.subMonths(_parse(month), n), 'yyyy-MM');
|
||||
}
|
||||
|
||||
6
upcoming-release-notes/1917.md
Normal file
6
upcoming-release-notes/1917.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [shall0pass]
|
||||
---
|
||||
|
||||
Goals: Fix infinite loop situation with Schedule keyword
|
||||
Reference in New Issue
Block a user