I have my pomodor clock mostly done but I’m having a couple issues:
When the user clicks the buttons to add/subtract time from the break or work session it updates on the clock, but after hitting start the clock doesn’t show the appropriate time. For example: If the clock is set to run for 1 minute and you increment the session time to 5 minutes, after hitting start the clock still only counts down from 1 minute.
I can’t get the reset function to properly reset the clock.
Been stuck on these issues for a while and any pointers would be appreciated.
I noticed that too and changed the click functions for the button:
I changed the totalSecondsWork from:
totalSecondsWork + 60;
to:
totalSecondsWork += 60;
$('#addSessionMinute').click(function(){
if(pomodoro.wTime < 60){
pomodoro.wTime += 1;
$('#sessionDisplay').text(pomodoro.wTime);
//Changes clock to new amount but also decrements by that amount per second instead of 1 seconds per second
totalSecondsWork += 60;
clockInit();
}
})
This updates the clock time the way it should i.e. pressing the work session button to 5 starts the clock from 4:59. The problem I’m having is now that also decrements each tick of the clock by 5 seconds instead of one. Whatever I increment the work session to the clock is decremented by that many seconds per tick. If I increment the session to 12 minutes the clock decrements 12 seconds per second and so forth.
I can’t figure out what’s causing this behavior. The tick function still decrements totalSecondsWork–. I don’t understand why changing the work session would cause this function to decrement more than once per second.