Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup tool group enhancement #2480

Merged
merged 8 commits into from
Apr 7, 2024

Conversation

shall0pass
Copy link
Contributor

@shall0pass shall0pass commented Mar 19, 2024

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.

@shall0pass shall0pass requested a review from youngcw March 19, 2024 13:59
@trafico-bot trafico-bot bot added the 🚧 WIP label Mar 19, 2024
Copy link

netlify bot commented Mar 19, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 16d8144
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/660c5b2b5101a0000878d016
😎 Deploy Preview https://deploy-preview-2480.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Mar 19, 2024

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
11 4.44 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/ButtonLink.js 379 B 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/import.js 105.26 kB 0%
static/js/AppliedFilters.js 20.35 kB 0%
static/js/BalanceTooltip.js 6.12 kB 0%
static/js/wide.js 249 kB 0%
static/js/narrow.js 215.48 kB 0%
static/js/ReportRouter.js 1.17 MB 0%
static/js/index.js 2.53 MB 0%

Copy link
Contributor

github-actions bot commented Mar 19, 2024

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.2 MB → 1.2 MB (+3.66 kB) +0.30%
Changeset
File Δ Size
packages/loot-core/src/server/budget/cleanup-template.ts 📈 +5.72 kB (+80.27%) 7.12 kB → 12.84 kB
packages/loot-core/src/server/budget/cleanup-template.pegjs 📈 +5.85 kB (+45.08%) 12.98 kB → 18.83 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 1.2 MB → 1.2 MB (+3.66 kB) +0.30%

Smaller

No assets were smaller

Unchanged

No assets were unchanged

@shall0pass shall0pass changed the title [WIP] Cleanup tool group enhancement Cleanup tool group enhancement Mar 19, 2024
@shall0pass shall0pass marked this pull request as ready for review March 19, 2024 17:48
@youngcw
Copy link
Member

youngcw commented Mar 20, 2024

I'm seeing that the global sources don't get their goal reset so the balance is colored yellow.

@shall0pass
Copy link
Contributor Author

I'm seeing that the global sources don't get their goal reset so the balance is colored yellow.

I think the balances are being reset, but maybe the original methodology was wrong? I'm seeing the same behavior in the original PR to this one. The goal is being set to the current months spending, so if the category balance is zeroed out and a negative budgeted amount is entered, it won't reach the threshold of the goal.

To turn a 'source' category green, maybe using the formula (budgeted-balance), which would set the budgeted amount to the same amount required to zero the category, should be used.

@shall0pass
Copy link
Contributor Author

This latest commit is quite a big change. I've updated the syntax, added a step to cover overspent categories within groups, and added the ability to add a category to a group that is neither a sink or source category.

The use case I've envisioned with the neither sink nor source category.

  1. Reimbursement holding fund -> ability to only affect covering categories meant to be reimbursed
  2. Utilities -> Possible to fund water, electricity, gas, etc and have utility categories cover overspending in other utility categories.

@shall0pass
Copy link
Contributor Author

@youngcw I see I inadvertently left the calculation for setting the goal indicator to 'budgeted - balance'. Take the opportunity to see if it is working better now. I'll revert it if it's still not what's expected.

@youngcw
Copy link
Member

youngcw commented Apr 2, 2024

Could you change the message for the global pass to include that its part of that group in some way?

@shall0pass
Copy link
Contributor Author

Could you change the message for the global pass to include that its part of that group in some way?

I'm not sure what you mean. Are you referring to #cleanup source and #cleanup sink?

@youngcw
Copy link
Member

youngcw commented Apr 2, 2024

I'm not sure what you mean. Are you referring to #cleanup source and #cleanup sink?

No the yellow message box when there isn't a sink. ( I think that was the warning). The messages for the lines with a group get the group name added to the message, but not the global pass

@shall0pass
Copy link
Contributor Author

I added Global: in front of the global warnings. I'm not sure this is the most concise way to express it, but I'm coming up blank on alternatives. Open to suggestions.

youngcw
youngcw previously approved these changes Apr 2, 2024
@trafico-bot trafico-bot bot removed the ✅ Approved label Apr 2, 2024
@shall0pass shall0pass merged commit 9030596 into actualbudget:master Apr 7, 2024
19 checks passed
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed ✅ Approved labels Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Merged Pull Request has been merged successfully
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants