Pomodo Clock having issue with switching to Session after Break?

just finished with the Pomodoro Clock but I can ‘t seem to find why I’ am not able to validate these two tests:

  1. When a break countdown reaches zero (NOTE: timer MUST reach 00:00), and a new countdown begins, the element with the id of “timer-label” should display a string indicating a session has begun.

  2. When a break countdown reaches zero (NOTE: timer MUST reach 00:00), a new session countdown should begin, counting down from the value currently displayed in the id=“session-length” element.

Though all seem to be working fine.

Any suggestion will be appreciated.
Thanks

Here is the link to the pen.

I don’t know but change html to text

 if (--session < 0) {
        if ($("#timer-label").text() == "Session") {
          music.play();//beep
          $("#timer-label").text("Break");
          session = parseInt($("#break-length").text(), 10) * 60;          
        } else {
          music.play(); //beep
          $("#timer-label").text("Session");
          session = parseInt($("#session-length").text(), 10) * 60;          
        }
      }

And in any other query assign, that may confuse even you set as html and check the text.

Thanks for your help. Made the changes you suggested but still the same issue :frowning:


if you look the test session passed near 2000 ms which is 2sec.and if the from second side it not pass
I am no sure if before this was, but your count countdown show by two seconds and can you explain this code?

myInterval = setInterval(function() {
      minutes = parseInt(session / 60, 10);
      seconds = parseInt(session % 60, 10);
      minutes = ("0" + minutes).slice(-2);
      seconds = ("0" + seconds).slice(-2);
      minutes = parseInt(session / 60, 10); //extract the number of minute in the var session
      seconds = parseInt(session % 60, 10); // extract the number of second in the var session 
      minutes = ("0" + minutes).slice(-2); // Add  0 in front of minutes when it is less than 2 digits
      seconds = ("0" + seconds).slice(-2); // Add 0 in front of the seconds when it is less than 2 digits

Why you have seconds with % even or odd number?
I think it should be as minute /.

I fetch the time in seconds.

Let’s say session is 1600 second. The way I use to separate minutes from seconds is to devide the whole by 60, put it in the var minutes, and put the remainder to seconds.

for 1600 seconds

1600 seconds = 26:40

I have just noticed this while running FCC script

Looks to be jumping Break, I still have to find the reason why. If only I can find the command the script is using to have this happen!!! :cold_sweat:

Not sure if this makes sense though!

I try change if (–session <0) { to if (–session <-1) {
, because you have too soon change the $("#timer-label"); in 00:00
There should be Session 00:00

1 Like

Thanks a lot for your help.

Fixed all and passed the test.

1 Like