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

[Bugfix] Goals: Fix Schedule Infinite loop #1917

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

shall0pass
Copy link
Contributor

Resolves #1913

When the next_date loop is executed, it is iterated in 1 day increments looking for a 'next schedule'. What was happening was the loop had a current date that occurred on a weekend and when we went to get the next occurrence (which should land on the weekend) it was returning that occurrence 1 day before. So each time the loop was set back 1 day before adding the 1 day and we had an infinite loop condition. I've added a check to look for how many days difference the current date and the next date are, and if that value is 0, it will add 3 days instead of 1. I used 3 to resolve the same situation had the schedule landed on a Sunday.

Copy link

netlify bot commented Nov 16, 2023

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit b7a5633
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/655672777f31cb0008963645
😎 Deploy Preview https://deploy-preview-1917.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 Nov 16, 2023

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
16 2.97 MB → 2.97 MB (+63 B) +0.00%
Changeset
File Δ Size
../loot-core/src/shared/months.ts 📈 +132 B (+1.47%) 8.76 kB → 8.89 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/main.js 1.15 MB → 1.15 MB (+63 B) +0.01%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/665.chunk.js 824.28 kB 0%
static/media/Inter-italic.var.woff2 239.29 kB 0%
static/media/Inter-roman.var.woff2 221.86 kB 0%
static/js/444.chunk.js 156.11 kB 0%
static/js/wide-components.chunk.js 127.18 kB 0%
static/js/231.chunk.js 117.37 kB 0%
static/js/reports.chunk.js 74.37 kB 0%
static/js/narrow-components.chunk.js 53.17 kB 0%
static/js/301.chunk.js 13.31 kB 0%
static/js/473.chunk.js 13 kB 0%
static/js/resize-observer-polyfill.chunk.js 8.88 kB 0%
static/css/main.css 7.41 kB 0%
asset-manifest.json 2.07 kB 0%
index.html 1.66 kB 0%
static/media/browser-server.js 903 B 0%

Copy link
Contributor

github-actions bot commented Nov 16, 2023

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
2 2.22 MB → 2.22 MB (+105 B) +0.00%
Changeset
File Δ Size
packages/loot-core/src/server/budget/goals/goalsSchedule.ts 📈 +395 B (+6.65%) 5.8 kB → 6.18 kB
packages/loot-core/src/shared/months.ts 📈 +132 B (+1.47%) 8.76 kB → 8.89 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 1.23 MB → 1.23 MB (+105 B) +0.01%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
xfo.xfo.kcab.worker.js 1014.46 kB 0%

@Kidglove57
Copy link

This works on my tests. Thank you!

@star-szr
Copy link

star-szr commented Nov 17, 2023

I would like to help test this but I can't figure out how to test locally or find any documentation on testing PRs locally. Help please!

Tested on Netlify and it works as expected, thanks for the quick fix!

Edit: Do folks usually just use the Netlify preview build for this purpose?

On a related note, is there a guide for setting up for local development that I failed to find? I ran into errors after cloning actualbudget/actual and trying to build it (it couldn't find ./bin/build-browser).

@shall0pass
Copy link
Contributor Author

@star-szr The netlify builds are perfect for testing things like this without having to deploy your own local service. There are a few cases they can fall short (i.e. api and actual-server interoperability) but for 99% of the PRs, it's amazing.

A good start for development would be here: https://actualbudget.org/docs/install/local#installing-actual

Instead of cloning the actual-server repo, clone the actualbudget/actual repo, or set up your github to be a fork of the actual repo and sync against that.

Then locally -> yarn install && yarn start:browser
You should be able to make changes to the code base and watch the effects in real time. Many use VSCode as the editor which has a lot of great features to make this effort simpler. In most cases, you don't need to run the ./bin/build-browser script.

@star-szr
Copy link

@shall0pass thank you! I had followed those steps to run actual-server just fine but didn't find anything about yarn start:browser for hacking on actual. I'm hoping that's the piece I was missing, I will test later.

Copy link
Member

@youngcw youngcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@shall0pass shall0pass merged commit 9392256 into actualbudget:master Nov 17, 2023
19 checks passed
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed ✅ Approved labels Nov 17, 2023
@shall0pass shall0pass deleted the goals_schedul1913 branch November 17, 2023 17:09
FlorianLang06 pushed a commit to FlorianLang06/actual that referenced this pull request Mar 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.

[Bug]: "Apply budget template" to future month with certain schedules causes infinite loop/crash
4 participants