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

Fix weekly goal calc if in last week of the year #520

Merged
merged 1 commit into from
Oct 5, 2021
Merged

Conversation

anarute
Copy link
Member

@anarute anarute commented Sep 29, 2021

If the week in case is the last week of the year, this method would fail because weeksTillEndOfJourneyPeriod is 0, causing a division by 0 exception.

Copy link
Member

@jaragunde jaragunde left a comment

Choose a reason for hiding this comment

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

This fixes the error, but provides a result of 0 in the last week of the year which is not correct either. Still, I can't find the way to get the result I would expect!

These weekly goals are extremely cursed and it's hard to understand how they work, the feature should be reworked... But that's a problem for another day, let's fix this failure now.

This would fix #432, would you mind adding the issue number to the commit message? Thanks!

If the week in case is the last week of the year,
this method would fail because weeksTillEndOfJourneyPeriod
is 0, causing a division by 0 exception

Fixes #432
@anarute
Copy link
Member Author

anarute commented Oct 1, 2021

This fixes the error, but provides a result of 0 in the last week of the year which is not correct either. Still, I can't find the way to get the result I would expect!

I was doing some tests and I think we'll need to refactor the whole logic.. it doesn't seem to be generating the expected result. Created #521 for this since fixing the division by zero error is a blocker for me at the moment.

This would fix #432, would you mind adding the issue number to the commit message? Thanks!

Done

@anarute anarute mentioned this pull request Oct 4, 2021
@jaragunde jaragunde merged commit 526d377 into main Oct 5, 2021
@jaragunde jaragunde deleted the fix-weekly-goal branch October 5, 2021 10:00
@jaragunde jaragunde mentioned this pull request Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants