macmorning / pomodoro-webext

GNU General Public License v3.0
40 stars 9 forks source link

Negative counter #26

Closed macmorning closed 3 weeks ago

macmorning commented 2 years ago

Sometimes the counter is negative, in Firefox at least.

Could be an issue with the alarm not firing when the session is locked.

macmorning commented 1 year ago

I still haven't managed to reproduce the issue at will. If someone has a clue, I'd love to have your input.

alchemiker commented 1 year ago

Hello, I will do further testing since I downloaded the extension just yesterday, but here are my steps to reproduce:

Here is a picture of what it looked like:

grafik

When I click on the icon in the menu bar, I quickly see for a glimpse of a moment a negative number (the one from the badge on the icon + a couple of seconds) above the clock, which then starts to count down from 20 as it should. But when I click the icon again, it shows again the same behaviour, and starts again counting down from 20 anew (in the little pop-up-window, as you see in the screenshot, not at the badge on the icon).

I hope to find out more in the next days-weeks, but maybe this helps already! Here is also my log: pomodoro-data.csv As you can see, I started today the timer, after the first session was ready I paused it (on break), then I unpaused it. But it never switched to the next sesson, even now, when I finish the post, it's around -17 minutes on break...

Otherwise, great minimalistic Addon! Thank you very much for making and maintaining it : )

kzieber commented 1 month ago

I've also had this issue. Adding a check to the updateBadge function in background.js fixed this locally for me, but I don't have permission to open a PR to correct it. Adding this check before the final else statement on line 103 should prevent the clock from going negative.

else if (clock.seconds === 0) { color = "lightskyblue"; title = "on a break" }

macmorning commented 1 month ago

Thanks to both of you. I completely missed the message from @alchemiker last year. I'll try to make up for it and patch the clock!

macmorning commented 4 weeks ago

There was a bug in the background script that would set the new alarm after a pause to a number of seconds * 60 instead of number of seconds / 60, so the internal ticking would continue for hours. The "delayInMinutes" parameter of the alarm would only take as little as 0.5 minute, so I switched to an actual alarm time ("when" parameter) instead of a delay, which is much more handy in our case. I will add a few other corrections, finish testing and upload the new version soon.

Thanks again for your help.