pomodoro-webext icon indicating copy to clipboard operation
pomodoro-webext copied to clipboard

Negative counter

Open macmorning opened this issue 3 years ago • 2 comments

Sometimes the counter is negative, in Firefox at least.

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

macmorning avatar Sep 02 '22 16:09 macmorning

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

macmorning avatar May 01 '23 10:05 macmorning

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

  • Set timer
  • when break started, stopped the timer for some time
  • then continued the timer again (in the break)
  • during break, I minimized the window of Firefox (Firefox Nightly, admittedly)
  • when it was surely past 5 minutes I was surprised that still no sound came
  • I opened the window again and saw a negative timer

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 : )

alchemiker avatar Aug 27 '23 15:08 alchemiker

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" }

kzieber avatar Jul 26 '24 16:07 kzieber

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 avatar Jul 26 '24 16:07 macmorning

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.

macmorning avatar Aug 21 '24 07:08 macmorning