[PR #2480] [MERGED] Cleanup tool group enhancement #18687

Closed
opened 2026-04-14 20:49:56 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/2480
Author: @shall0pass
Created: 3/19/2024
Status: Merged
Merged: 4/7/2024
Merged by: @shall0pass

Base: masterHead: cleanup_groups


📝 Commits (8)

  • 5b7016b add group enhancement
  • b365fb8 warnings
  • 415e75d note
  • b7ebf3c Merge branch 'master' into cleanup_groups
  • 9928321 add more group functions
  • d0a2b02 Merge branch 'master' into cleanup_groups
  • 274d8c7 add Global: to differentiate warning from group warnings
  • 16d8144 weights not properly recorded for sinking groups, safeNumber error

📊 Changes

3 files changed (+202 additions, -13 deletions)

View changed files

📝 packages/loot-core/src/server/budget/cleanup-template.pegjs (+16 -4)
📝 packages/loot-core/src/server/budget/cleanup-template.ts (+180 -9)
upcoming-release-notes/2480.md (+6 -0)

📄 Description

This PR adds new ways to use the cleanup templates.

Group names can now be used to target specific categories.

Examples:

1st category (contributes 50):   #cleanup MyFirstGroup source 
2nd category (contributes 100):   #cleanup MyFirstGroup source 
3rd category (receives 100):   #cleanup MyFirstGroup sink 2 
4th category (receives 50):   #cleanup MyFirstGroup sink
5th category (overspent): #cleanup MyFirstGroup

6th category (contributes 300):   #cleanup My Second Group source 
7th category (receives 200):   #cleanup My Second Group sink 2 
8th category (receives 100):   #cleanup My Second Group sink
9th category (overspent): #cleanup My Second Group

10th category (contributes 700):   #cleanup source
11th category (receives 700):   #cleanup sink

MyFirstGroup
In this example, all source funds from MyFirstGroup will only be distributed within MyFirstGroup. The 5th category also belongs to the group, which is neither a source nor a sink category, will be filled if it is overspent/under funded. The sink categories will then be funded based on the weight given.

My Second Group
All source funds from 'My Second Group' will be distributed to 'My Second Group'. They work independently of one another. The 9th category, which is part of 'My Second Group' will be funded before anything is distributed if it is overspent/under funded and then the funds from 'My Second Group' will be distributed to the sink categories based on weight.

Global
The group disbursements are calculated first (MyFirstGroup and My Second Group).
No source or sink templates that have a group defined will be used in the 'global' portion of the script. Any underfunded category will continue to be funded first (including the categories in groups), as long as the rollover carryover is not present.

After all groups are considered, the script runs as before and distributes the 'global' funds.

If a 'group sink' category is wished to be included in the 'global sink' calculation, a second line of #cleanup sink needs to be added to the category notes.

If anyone has any feedback on the order of operations here, I'm open.
Currently it's:

  1. Find groups
  2. Run groups (source and sink)
  3. Find 'global' source funds and return to 'To Budget'
  4. Fund underfunded categories
  5. Fill sinking funds

I could see a case for moving (2) after (5) in order to fill underfunded categories first and then distribute the groups.


🔄 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/2480 **Author:** [@shall0pass](https://github.com/shall0pass) **Created:** 3/19/2024 **Status:** ✅ Merged **Merged:** 4/7/2024 **Merged by:** [@shall0pass](https://github.com/shall0pass) **Base:** `master` ← **Head:** `cleanup_groups` --- ### 📝 Commits (8) - [`5b7016b`](https://github.com/actualbudget/actual/commit/5b7016bcbf7f3b8837520833673cfd3292e13485) add group enhancement - [`b365fb8`](https://github.com/actualbudget/actual/commit/b365fb8f6722fe0756852dfff17fafbb0ee2e612) warnings - [`415e75d`](https://github.com/actualbudget/actual/commit/415e75d4e466aff5b42bb051331d3a5a03f98b40) note - [`b7ebf3c`](https://github.com/actualbudget/actual/commit/b7ebf3c4f188c91a357db2d554efb2f32254550b) Merge branch 'master' into cleanup_groups - [`9928321`](https://github.com/actualbudget/actual/commit/9928321326b1ca5e550908b0b1bf6e4220485da7) add more group functions - [`d0a2b02`](https://github.com/actualbudget/actual/commit/d0a2b0268d2d5016dd3cc68a43ed8965686fbe26) Merge branch 'master' into cleanup_groups - [`274d8c7`](https://github.com/actualbudget/actual/commit/274d8c7968c055c8dbc8b3b5d6de78a34b428945) add Global: to differentiate warning from group warnings - [`16d8144`](https://github.com/actualbudget/actual/commit/16d814471f60b05bca2caae19948e56d1db39646) weights not properly recorded for sinking groups, safeNumber error ### 📊 Changes **3 files changed** (+202 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/budget/cleanup-template.pegjs` (+16 -4) 📝 `packages/loot-core/src/server/budget/cleanup-template.ts` (+180 -9) ➕ `upcoming-release-notes/2480.md` (+6 -0) </details> ### 📄 Description This PR adds new ways to use the cleanup templates. Group names can now be used to target specific categories. Examples: ``` 1st category (contributes 50): #cleanup MyFirstGroup source 2nd category (contributes 100): #cleanup MyFirstGroup source 3rd category (receives 100): #cleanup MyFirstGroup sink 2 4th category (receives 50): #cleanup MyFirstGroup sink 5th category (overspent): #cleanup MyFirstGroup 6th category (contributes 300): #cleanup My Second Group source 7th category (receives 200): #cleanup My Second Group sink 2 8th category (receives 100): #cleanup My Second Group sink 9th category (overspent): #cleanup My Second Group 10th category (contributes 700): #cleanup source 11th category (receives 700): #cleanup sink ``` **MyFirstGroup** In this example, all source funds from MyFirstGroup will only be distributed within MyFirstGroup. The 5th category also belongs to the group, which is neither a source nor a sink category, will be filled if it is overspent/under funded. The sink categories will then be funded based on the weight given. **My Second Group** All source funds from 'My Second Group' will be distributed to 'My Second Group'. They work independently of one another. The 9th category, which is part of 'My Second Group' will be funded before anything is distributed if it is overspent/under funded and then the funds from 'My Second Group' will be distributed to the sink categories based on weight. **Global** The group disbursements are calculated first (MyFirstGroup and My Second Group). No source or sink templates that have a group defined will be used in the 'global' portion of the script. Any underfunded category will continue to be funded first (including the categories in groups), as long as the rollover carryover is not present. After all groups are considered, the script runs as before and distributes the 'global' funds. If a 'group sink' category is wished to be included in the 'global sink' calculation, a second line of ```#cleanup sink ``` needs to be added to the category notes. If anyone has any feedback on the order of operations here, I'm open. Currently it's: 1. Find groups 2. Run groups (source and sink) 3. Find 'global' source funds and return to 'To Budget' 4. Fund underfunded categories 5. Fill sinking funds I could see a case for moving (2) after (5) in order to fill underfunded categories first and then distribute the groups. --- <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-14 20:49:56 -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#18687