[PR #1028] [MERGED] Goals: Compounding changes for By and Schedules #3474

Closed
opened 2026-02-28 20:42:11 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/1028
Author: @shall0pass
Created: 5/12/2023
Status: Merged
Merged: 5/13/2023
Merged by: @j-f1

Base: masterHead: goalsCompoundingV2


📝 Commits (5)

📊 Changes

2 files changed (+37 additions, -45 deletions)

View changed files

📝 packages/loot-core/src/server/budget/goaltemplates.ts (+31 -45)
upcoming-release-notes/1028.md (+6 -0)

📄 Description

This PR depends on https://github.com/actualbudget/actual/pull/1024. I will merge and verify any conflicts if it is accepted.
It was easier to to just combine the PRs. This change fixes the infinite loop as well.

I believe this PR fixes https://github.com/actualbudget/actual/issues/970

The difference in calcuations: The by matches were using averages, which when proposed I didn't think about large differences in targets. The schedule matches would only save up to the last 'schedule' evaluated. This new approach subtracts the previous months balance from the first evaluated template and keeps track of the remainder. Any remainder will be subtracted from the next goal template, and so on.

I've set up two tests to showcase. The first has two 'by' statements and two 'schedule' statements that are close in value to one another. The current implementation gives these results.
current_compounding_closeValues

This PR would change that behavior to the following screen shot.
pr_compoundingV2_close values

The second test uses two scheduled values that are very different from one another. One is 5000 and the second is 300. The 5000 is purposefully scheduled first to show the issue.

Current implementation. Notice that the 5000 target is not satisfied by the due date.
current_compounding_bigDifference

Proposed implementation. Notice that both amounts are satisfied by the due dates.
pr_compoundingV2_bigDifference

I'm adding the test budgets I used for these tests if anyone would like to explore further.

2023-05-12-similar amounts.zip
2023-05-12-big difference amounts.zip


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/1028 **Author:** [@shall0pass](https://github.com/shall0pass) **Created:** 5/12/2023 **Status:** ✅ Merged **Merged:** 5/13/2023 **Merged by:** [@j-f1](https://github.com/j-f1) **Base:** `master` ← **Head:** `goalsCompoundingV2` --- ### 📝 Commits (5) - [`eda7638`](https://github.com/actualbudget/actual/commit/eda763808f6ef813e6b93d48eb74af43626b239d) compounding - [`bfd5b82`](https://github.com/actualbudget/actual/commit/bfd5b824d6f20839a7b223c07663e5bd44b01cfa) fix - [`a85f97e`](https://github.com/actualbudget/actual/commit/a85f97e2ecb81ec77b2df32706aec4d7f6b35119) guessed wrong - [`92cdca0`](https://github.com/actualbudget/actual/commit/92cdca089c2aeab3689ae3387f331d3c78671281) reset months to 01 - [`7475256`](https://github.com/actualbudget/actual/commit/7475256794def0078b6ae042adca60c2aed390e1) lint ### 📊 Changes **2 files changed** (+37 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/budget/goaltemplates.ts` (+31 -45) ➕ `upcoming-release-notes/1028.md` (+6 -0) </details> ### 📄 Description ~This PR depends on https://github.com/actualbudget/actual/pull/1024. I will merge and verify any conflicts if it is accepted.~ It was easier to to just combine the PRs. This change fixes the infinite loop as well. I believe this PR fixes https://github.com/actualbudget/actual/issues/970 The difference in calcuations: The `by` matches were using averages, which when proposed I didn't think about large differences in targets. The `schedule` matches would only save up to the last 'schedule' evaluated. This new approach subtracts the previous months balance from the first evaluated template and keeps track of the remainder. Any remainder will be subtracted from the next goal template, and so on. I've set up two tests to showcase. The first has two 'by' statements and two 'schedule' statements that are close in value to one another. The current implementation gives these results. ![current_compounding_closeValues](https://github.com/actualbudget/actual/assets/20625555/88691af9-a57a-4c48-a266-e0fda583994e) This PR would change that behavior to the following screen shot. ![pr_compoundingV2_close values](https://github.com/actualbudget/actual/assets/20625555/cceb460d-ab8d-4c55-85e0-e7dc16ccaa2e) The second test uses two scheduled values that are very different from one another. One is 5000 and the second is 300. The 5000 is purposefully scheduled first to show the issue. Current implementation. Notice that the 5000 target is not satisfied by the due date. ![current_compounding_bigDifference](https://github.com/actualbudget/actual/assets/20625555/7e4395d0-e5ac-47d2-a9c2-5bd92691bff7) Proposed implementation. Notice that both amounts are satisfied by the due dates. ![pr_compoundingV2_bigDifference](https://github.com/actualbudget/actual/assets/20625555/c31f2ffb-68b7-437a-a60b-84db8427fe1c) I'm adding the test budgets I used for these tests if anyone would like to explore further. [2023-05-12-similar amounts.zip](https://github.com/actualbudget/actual/files/11466424/2023-05-12-similar.amounts.zip) [2023-05-12-big difference amounts.zip](https://github.com/actualbudget/actual/files/11466425/2023-05-12-big.difference.amounts.zip) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 20:42:11 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#3474