vinnymac / PokeNurse

💉 A tool for Pokémon Go to aid in transferring and evolving Pokémon
284 stars 55 forks source link

Progress bar fluctuates during large transfers #153

Closed iPaulis closed 7 years ago

iPaulis commented 7 years ago

Progress bar goes up and down many times, it is specially noticeable during large transfer queues. It is a bit strange, it even reaches 100% when there are still 25 secs left for example and then decreases and reaches 100% again several times. I think I observed this in v1.4 too, but now in v1.5 maybe my transfer queue was longer and I noticed it more.

vinnymac commented 7 years ago

We definitely changed the math for the progress from v1.4 to v1.5, so it is possible this started happening. I am certain I have seen this before, the counter and the progress are currently very differently calculated, because one is an interval counter and the other is based on whether or not the action has been completed.

Currently the label is fixed to be 2 digits, so numbers like 20.99 and 20.01 appear as only 20. But the value we send to the progress bar is the actual value. I am not sure if that causes any issues, but we could probably just start sending the same value for both without any problems arising.

Also the new math for progress looks like this const now = (currentPosition / progress.selectedPokemon.length) * 100 If for some reason the array positions are changing between actions then the progress wouldn't be calculated correctly. It would be very strange if that was happening though, since we only add the array when you confirm the action. If someone thinks this doesn't make sense or finds the issue, let me know. Thanks for the report.

EDIT: Because we use the current position in the calculation I think that is the main reason this can fluctuate. The current position is based on the last pokemon that has successfully completed its action, but they do not have to complete in order. Meaning #5 could happen before #2, and then the bar will move all over the place. This is even more likely to happen when firing off a lot of requests. One fix is firing off the requests in order, instead of firing them off based on a random delay.