IraSoro / peri

The period tracker app
https://irasoro.github.io/peri/
20 stars 8 forks source link

Fix incorrect day shift after cycle edit #262

Closed IraSoro closed 1 month ago

IraSoro commented 1 month ago

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.

imblowfish commented 1 month ago

Everything is fine except of sentence above