Pomodoro clock help!

I’m almost done with my Pomodoro Clock. Everything is okay except for one thing.

If I pause while it’s timing and reset, although the values of work and rest return to 25 and 5, when I press start, instead of starting from scratch, it simply resumes where I had paused. I need to be able to reset and start from scratch again.

It works just fine for me.

Not sure how much help I can be. I’m using Chrome! =D

Hey,

Start the clock

Wait till it reaches 24:55 and pause

Reset the clock

Start the clock again

It will start at 24:54 not 24:59

Hi @ed-kahara

The problem seems to be that in your reset method, you are resetting the workCount & restCount variables, but not the work & rest variables which seem to be the ones the calculate the time.

(this.id === 'reset') {
      document.body.style.backgroundColor = "green";
      $('#restTimeLeft, #restTime, #pause, #reset, #workTimeLeft').hide();
      workCount = 25;
      restCount = 5;
      // Suggest resetting work & rest here
      $('#workTime').html(workCount);
      $('#restTime').html(restCount);
      $('#minusWork, #plusWork, #minusRest, #plusRest, #work, #rest, #start, #restTime, #workTime').show();
    }

Hey,

Good observation, but for some reason it still doesn’t work. In fact if I reset work & rest below the code stops working when I press start.

I did this and it worked for me

(this.id === 'reset') {
      document.body.style.backgroundColor = "green";
      $('#restTimeLeft, #restTime, #pause, #reset, #workTimeLeft').hide();
      workCount = 25;
      restCount = 5;
      work = workCount * 60;
      rest = restCount * 60;
      $('#workTime').html(workCount);
      $('#restTime').html(restCount);
      $('#minusWork, #plusWork, #minusRest, #plusRest, #work, #rest, #start, #restTime, #workTime').show();
    }

Still doesn’t work for me.
But I’ve discovered other mistakes I have to work on as well.

Hey,

I figured it out. I added a resume button to handle resuming of time. The start button was starting new timers and resuming, so it was overworked. Everything works fine now.

Thank you so much…

1 Like

Nice one, good job dude