-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Goals] fix how goal values are calculated #3817
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey 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
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller
Unchanged
|
Bundle Stats — loot-coreHey 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
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged No assets were unchanged |
WalkthroughThe pull request introduces significant modifications to the budgeting logic within the Possibly related PRs
Suggested labels
Suggested reviewers
Warning There were issues while running the following tools: 🔧 eslintpackages/loot-core/src/server/budget/categoryTemplate.tsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-eslint-plugin". (The package "eslint-plugin-eslint-plugin" was not found when loaded as a Node module from the directory "/packages/eslint-plugin-actual".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-eslint-plugin" was referenced from the config file in "packages/eslint-plugin-actual/.eslintrc.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
packages/loot-core/src/server/budget/categoryTemplate.ts (3)
140-148
: Consider adding comments to clarify the use offullAmount
In the
runTemplatesForPriority
method,this.fullAmount
is updated withtoBudget
before any adjustment is made totoBudget
in theif
block (lines 142–143). This suggests thatfullAmount
represents the total requested amount before any budget adjustments. To improve code readability, please add comments to clarify this logic.
158-160
: Review the reset offullAmount
inapplyLimit
When the limit hold condition is met and the limit amount has been reached,
this.fullAmount
is reset to zero (line 158). SincefullAmount
tracks the total requested amount, resetting it to zero may affect the accuracy of goal calculations. Please verify that this behavior aligns with the intended functionality.
165-165
: Confirm the assignment offullAmount
after applying limitAt line 165,
this.fullAmount
is assigned the value ofthis.toBudgetAmount
after adjustingtoBudgetAmount
due to exceeding the limit. SincefullAmount
is intended to represent the total requested amount before limits are applied, consider whether this assignment accurately reflects the desired behavior.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
upcoming-release-notes/3817.md
is excluded by!**/*.md
📒 Files selected for processing (2)
packages/loot-core/src/server/budget/categoryTemplate.ts
(4 hunks)packages/loot-core/src/server/budget/goaltemplates.ts
(0 hunks)
💤 Files with no reviewable changes (1)
- packages/loot-core/src/server/budget/goaltemplates.ts
🔇 Additional comments (1)
packages/loot-core/src/server/budget/categoryTemplate.ts (1)
271-271
: Use fullAmount
for goalAmount
to reflect total requested amount
By setting this.goalAmount = this.fullAmount;
at line 271, the goal now represents the total requested amount before any budget adjustments. This change aligns with the intent to accurately track goal values.
seems when using priority it doesnt calculate properly on a non when setting the template to |
@deathblade666 Im seeing 750 as the goal amount no matter the priority, or if I include $ or not. |
maybe im not understanding correctly then, this is what im seeing with the priority. i would expect the goal to indicate the total amount to be budgeted per the template. if thats not how it works then i've missunderstood. To be clear this is on my personal instance not the build associated with this PR |
@deathblade666 and that is using exactly the template you stated above? Are you sure you are using the PR build? I copied your template example directly into a test budget and always got 750 as the goal. |
@youngcw that screenshot was from my personal instance, testing the PR build now |
yep appears to be good in the PR build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tested with the method reported on Discord
I had messed up how the template goal values were calculated in the recent rewrite.
I had to change the following: