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 incorrect day shift after cycle edit #262

Merged
merged 9 commits into from
Jul 29, 2024
Merged

Conversation

IraSoro
Copy link
Owner

@IraSoro IraSoro commented Jul 26, 2024

Closed #258

I found the reason why the shift is happening. We have a maximum number of cycles in the storage. So if we already have the maximum number of cycles stored, then when adding a new one, one is deleted. If we return everything after this, then one of the cycles has already been deleted, so new average values ​​are recalculated. And since the average values ​​have changed, the forecast has changed.

I solved this problem like this.

  1. I increased the maximum number of stored cycles to 8.
  2. Now the average is calculated only from those cycles that are displayed in the application (6 of them). Therefore, 2 more will be spare, we do not take them into account in the calculations, but they are stored for these cases as in these bug.

I also found another bug. My peri.json file has more than 7 cycles stored, I fixed it. I didn't before slice the cycles that we send to storage.

@IraSoro IraSoro added this to the v2.4.2 milestone Jul 26, 2024
@IraSoro IraSoro requested a review from imblowfish July 26, 2024 11:30
@IraSoro IraSoro self-assigned this Jul 26, 2024
@imblowfish
Copy link
Collaborator

Everything is fine except of sentence above

imblowfish
imblowfish previously approved these changes Jul 27, 2024
src/state/CalculationLogics.ts Outdated Show resolved Hide resolved
@IraSoro IraSoro requested a review from imblowfish July 28, 2024 17:51
src/state/CalculationLogics.ts Outdated Show resolved Hide resolved
@IraSoro IraSoro merged commit 7352bb3 into master Jul 29, 2024
1 check passed
@IraSoro IraSoro deleted the 258-fix-edit-shift branch July 29, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Incorrect day shift after cycle edit
2 participants