[PR #879] [MERGED] Change method of calculating 'by' matches to use averaging #10437

Closed
opened 2026-04-10 20:33:03 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/879
Author: @shall0pass
Created: 4/9/2023
Status: Merged
Merged: 4/22/2023
Merged by: @j-f1

Base: masterHead: goals_byMatch_rework


📝 Commits (8)

📊 Changes

2 files changed (+28 additions, -6 deletions)

View changed files

📝 packages/loot-core/src/server/budget/goaltemplates.js (+22 -6)
upcoming-release-notes/879.md (+6 -0)

📄 Description

I've changed the method of calculating the budgeted amount. There may be a more efficient way of writing the loop, so I'm looking forward to the review.

This change implements the mathematics of (Target1+Target2+TargetN-Last_months_category_balance) / (MonthsRemaing1 + MonthsRemaining2 + MonthsRemaingN) * N. This is an averaged approach for multiple templates in the same category. It will appear to overbudget or underbudget some months compared to multiple single targets in different categories, yet there should always be enough saved in the category to satisfy the target due.

Setting a target, it's assumed that money will be spent in the appropriate month, When a target reaches maturity, the money in the category associated with that target should be spent or moved so the remaining targets continue to be funded. I don't see an easy way of fixing that, but I hope this change will be of some help.

Current method:
Notice how the Bills (flexible) category reduces each month, resulting in larger budgeted amounts later in the goal cycle.

Templates-now

Proposed method:
**Note: The fact that the initial fill in this example equals the expected fill is a coincidence based on the template values I chose. The initial fills can be different from expected fill.

Templates-proposed


🔄 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/879 **Author:** [@shall0pass](https://github.com/shall0pass) **Created:** 4/9/2023 **Status:** ✅ Merged **Merged:** 4/22/2023 **Merged by:** [@j-f1](https://github.com/j-f1) **Base:** `master` ← **Head:** `goals_byMatch_rework` --- ### 📝 Commits (8) - [`263b540`](https://github.com/actualbudget/actual/commit/263b54071b4a2d8e24ba8b462470acc74816123f) Changed method of calculating 'by' matches - [`558a5a6`](https://github.com/actualbudget/actual/commit/558a5a655bb0dc4417f70ce0e94bb90d616ea66d) lint - [`f21c83f`](https://github.com/actualbudget/actual/commit/f21c83f74029e789ad2e97725837961f98d9b995) fixup - [`919ec78`](https://github.com/actualbudget/actual/commit/919ec782323727288faa642a2d4cfc1649b6c318) release notes - [`40b15f9`](https://github.com/actualbudget/actual/commit/40b15f9df80e251ea1eeb974836d6962b63aff8d) Update 879.md - [`ebb2951`](https://github.com/actualbudget/actual/commit/ebb29512da92c14cd8451a0d2f8697f5355d3bd4) remove unneeded loop - [`7e17e0f`](https://github.com/actualbudget/actual/commit/7e17e0fccfe2ca676ddc435321dee6f055228d43) Merge branch 'master' into goals_byMatch_rework - [`73f77e2`](https://github.com/actualbudget/actual/commit/73f77e28dcf359e3b598617785b804bb146d3170) lint ### 📊 Changes **2 files changed** (+28 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/budget/goaltemplates.js` (+22 -6) ➕ `upcoming-release-notes/879.md` (+6 -0) </details> ### 📄 Description I've changed the method of calculating the budgeted amount. There may be a more efficient way of writing the loop, so I'm looking forward to the review. This change implements the mathematics of (Target1+Target2+TargetN-Last_months_category_balance) / (MonthsRemaing1 + MonthsRemaining2 + MonthsRemaingN) * N. This is an averaged approach for multiple templates in the same category. It will appear to overbudget or underbudget some months compared to multiple single targets in different categories, yet there should always be enough saved in the category to satisfy the target due. Setting a target, it's assumed that money will be spent in the appropriate month, When a target reaches maturity, the money in the category associated with that target should be spent or moved so the remaining targets continue to be funded. I don't see an easy way of fixing that, but I hope this change will be of some help. Current method: Notice how the Bills (flexible) category reduces each month, resulting in larger budgeted amounts later in the goal cycle. ![Templates-now](https://user-images.githubusercontent.com/20625555/230964939-d20ca72b-1055-471a-9044-7cd640f19875.gif) Proposed method: **Note: The fact that the initial fill in this example equals the expected fill is a coincidence based on the template values I chose. The initial fills can be different from expected fill. ![Templates-proposed](https://user-images.githubusercontent.com/20625555/230965265-669f996c-3112-437b-ab83-9715ea5dfc7f.gif) --- <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-04-10 20:33:03 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#10437