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

Added Pay Distribution Template to Goal-templates #3078

Conversation

Midgetwombat
Copy link

@Midgetwombat Midgetwombat commented Jul 17, 2024

THIS PR HAS BEEN REPLACED WITH PR #3176. Please read here for comments and explanation. And review code at 3176.

Added a new Template type called Pay Distribution, which is designed to be triggered every time the apply template is clicked. if a Pay Distribution template is applied to a category then instead of adding to the goal the distribution template will just add its value to the currently budgeted amount. if a normal template is applied to the category as well, then that template will add to the goal but will not change the value of the budgeted column.

The purpose of this new template is for people who budget by paycheck which may not be monthly, or for those who are still working on building up their funds to have enough to budget for a month.

The pay Distribution Template has two operations either a set amount OR a percentage of the remaining available funds.
Additionally, if the pay distribution template is added to the same category as the remainder template, then the remaining budget will be added to that category also. Otherwise, the remainder template will retain its normal functionality.

…ted instead of replacing.

Added + to the syntax for goal-template. When put before the value and after the priority will prevent ProcessTemplate() from clearing the value from budgeted, so the template can add its amount instead.  This feature will be useful for people who do their budgets weekly or by paycheck.

EXAMPLE: #template +$50

Note: This functionality was not applied to all template types; schedule was skipped.
@actual-github-bot actual-github-bot bot changed the title Added feature to Goal-template, so when triggered adds value to budge… [WIP] Added feature to Goal-template, so when triggered adds value to budge… Jul 17, 2024
Copy link

netlify bot commented Jul 17, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 5097edc
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/66aca6f6199cd200089bfb4c
😎 Deploy Preview https://deploy-preview-3078.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 Jul 17, 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
9 4.8 MB → 4.8 MB (-3.61 kB) -0.07%
Changeset
File Δ Size
src/components/budget/index.tsx 📈 +42 B (+0.47%) 8.7 kB → 8.75 kB
src/components/mobile/budget/index.tsx 📈 +36 B (+0.37%) 9.62 kB → 9.65 kB
src/components/mobile/transactions/TransactionEdit.jsx 📉 -31 B (-0.09%) 32.51 kB → 32.48 kB
src/components/autocomplete/CategoryAutocomplete.tsx 📉 -13 B (-0.13%) 9.96 kB → 9.95 kB
src/components/settings/Experimental.tsx 📉 -13 B (-0.41%) 3.08 kB → 3.06 kB
src/components/settings/BudgetTypeSettings.tsx 📉 -13 B (-0.51%) 2.49 kB → 2.48 kB
src/components/reports/graphs/SpendingGraph.tsx 📉 -211 B (-2.48%) 8.31 kB → 8.1 kB
src/components/reports/reports/SpendingCard.tsx 📉 -252 B (-6.42%) 3.83 kB → 3.59 kB
src/components/reports/spreadsheets/spending-spreadsheet.ts 📉 -750 B (-14.54%) 5.04 kB → 4.3 kB
src/components/reports/reports/Spending.tsx 📉 -2.43 kB (-16.76%) 14.52 kB → 12.08 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/wide.js 277.26 kB → 277.31 kB (+42 B) +0.01%
static/js/narrow.js 78.27 kB → 78.3 kB (+36 B) +0.04%

Smaller

Asset File Size % Changed
static/js/ReportRouter.js 1.23 MB → 1.23 MB (-3.62 kB) -0.29%
static/js/index.js 3.04 MB → 3.04 MB (-70 B) -0.00%

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/BackgroundImage.js 122.29 kB 0%
static/js/usePreviewTransactions.js 790 B 0%
static/js/AppliedFilters.js 27.61 kB 0%

Copy link
Contributor

github-actions bot commented Jul 17, 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.14 MB → 1.14 MB (+1.93 kB) +0.17%
Changeset
File Δ Size
packages/loot-core/src/server/budget/goals/payDistribution.ts 🆕 +1.03 kB 0 B → 1.03 kB
packages/loot-core/src/server/budget/goals/goalsRemainder.ts 📈 +210 B (+13.78%) 1.49 kB → 1.69 kB
packages/loot-core/src/server/budget/goaltemplates.ts 📈 +3.18 kB (+13.67%) 23.29 kB → 26.48 kB
packages/loot-core/src/server/budget/goal-template.pegjs 📈 +6.44 kB (+11.83%) 54.47 kB → 60.91 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 1.14 MB → 1.14 MB (+1.93 kB) +0.17%

Smaller

No assets were smaller

Unchanged

No assets were unchanged

@youngcw
Copy link
Member

youngcw commented Jul 17, 2024

If you are ready to get this reviewed remove the [WIP] label. Also to fix the lint error run yarn lint --fix. It looks like there are some debug prints in there, could you remove those?

Fixed a mistake I made with not removing the test code.
@Midgetwombat Midgetwombat changed the title [WIP] Added feature to Goal-template, so when triggered adds value to budge… Added feature to Goal-template, so when triggered adds value to budge… Jul 17, 2024
@youngcw
Copy link
Member

youngcw commented Jul 17, 2024

I haven't tried it yet, but I don't think this makes sense to add to the remainder template

@Midgetwombat
Copy link
Author

I haven't tried it yet, but I don't think this makes sense to add to the remainder template

You're probably right, i haven't played with the remainder feature and originally i didn't have it. But before pushing in my mind I thought someone may like the remainder of their paycheck to be added to a 'budgeted' like savings.

@youngcw
Copy link
Member

youngcw commented Jul 17, 2024

Im wondering if it would be better to keep the number of templates that can do this low. Some of the more involved templates could just get confusing with this option. I think we need to figure something out as well for the what goal gets set. Right now the goal is set like normal, but the budget amount likely is higher than that goal.

@youngcw youngcw linked an issue Jul 17, 2024 that may be closed by this pull request
2 tasks
@Midgetwombat
Copy link
Author

Midgetwombat commented Jul 18, 2024

Im wondering if it would be better to keep the number of templates that can do this low. Some of the more involved templates could just get confusing with this option. I think we need to figure something out as well for the what goal gets set. Right now the goal is set like normal, but the budget amount likely is higher than that goal.

Okay so what i'll do is, reduce the templates down to simple and percentage i think that's a good middle ground, I Still think having the remainder is a good idea But i trust someone who has done this for a while. When you mention about the 'goal is normal, but budget amount likely is higher', not quite sure what you mean. If your referring to the 'up to' syntax then i'll do some testing and if that does not work correctly i'll see what i can do about it. I do have another idea of implementation of this that could help with that issue. Let me know if i need to change this back to [WIP]. Again this is my first time contributing to a project and using Git. Thanks a lot for your time.

@youngcw
Copy link
Member

youngcw commented Jul 18, 2024

When you mention about the 'goal is normal, but budget amount likely is higher', not quite sure what you mean.

I mean the part of the processing that sets the goal in the database. Thats what informs the green/yellow coloring in the budget table. Those aren't getting changed to match that the new amount that the template wants is greater than a single template run asks for. This makes it so you could remove funds and still be in the green even though the budgeted amount is less than what the templates budgeted.

@Midgetwombat
Copy link
Author

When you mention about the 'goal is normal, but budget amount likely is higher', not quite sure what you mean.

I mean the part of the processing that sets the goal in the database. Thats what informs the green/yellow coloring in the budget table. Those aren't getting changed to match that the new amount that the template wants is greater than a single template run asks for. This makes it so you could remove funds and still be in the green even though the budgeted amount is less than what the templates budgeted.

Okay thanks, I'm going to move this back to work in progress and test for these things, and prob do some rework of code. I'll move it back to review when I think I have corrected the issues and maybe a draft for documentation, explaining the feature better. I appreciate your input.

@Midgetwombat Midgetwombat changed the title Added feature to Goal-template, so when triggered adds value to budge… [WIP] Added feature to Goal-template, so when triggered adds value to budge… Jul 18, 2024
@Midgetwombat Midgetwombat marked this pull request as draft July 29, 2024 07:01
@Midgetwombat
Copy link
Author

Pay Distribution Template has been added. This adds the + directive and can only be used as "#template +$" for a set amount to be taken from the available budget, or "#template +%" to use a percentage of the available amount. This new template will not set a goal but be used to add to the current budgeted amount for that month. Additionally, all other templates active on that category will till register to a goal but will not add their amounts to the budgeted. The mindset behind this template is for people who budget by paycheck or don't have the funds to budget for a whole month but want to work towards a goal. Also if a secondary template has the 'up to' and 'hold' flags active the new Pay Distribution template will respect those rules.

@Midgetwombat
Copy link
Author

Midgetwombat commented Jul 30, 2024

EXAMPLE 1:
image
In this example we have activated the pay distribution template to put $50 in each time the apply template is clicked. We have also indicated we want to set a goal of $100 but don't want more than $200. Additionally, anything we have manually put into our budgeted we don't want to be wiped.

EXAMPLE 2:
image
In this example, we want 20% of the remaining available budget to be put into the budgeted each time we click apply template. (available budget may differ from originally displayed as it works on what's left after each category takes its share). We are also not setting a goal here so the balance will always be green.

EXAMPLE 3:
image
In this example, we are using the remainder template notice we have used the Pay Distribution template also with a value of zero. The purpose here is so the Pay distribution template will not add anything to the budgeted but instead trigger the remainder template to always add whatever is left into its category after each click of apply template.

The way to think of Pay Distribution is to quickly distribute your wages into the categories you need if you are not paid monthly. But use the normal templates to set your goals. All other templates should work as normal. the only functionality on other templates that change is setting the budgeted amount when there is a Pay Distribution template active on that category.

RESULTS:
Food = Example 1
Bills = Example 2
Savings = Example 3

BEFORE:
image

AFTER:
image

ADDED PAYCHECK:

BEFORE APPLY TEMPLATE:
image

AFTER APPLY TEMPLATE:
image

@Midgetwombat Midgetwombat marked this pull request as ready for review July 30, 2024 02:33
@actual-github-bot actual-github-bot bot changed the title [WIP] Added feature to Goal-template, so when triggered adds value to budge… Added feature to Goal-template, so when triggered adds value to budge… Jul 30, 2024
@Midgetwombat Midgetwombat changed the title Added feature to Goal-template, so when triggered adds value to budge… Added Pay Distribution Template to Goal-templates Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Goal template flag to add funds to category
2 participants