Pomodoro Clock 28/29

Hi guys!

I am having an issue with my Pomodoro Clock FCC project, link: Clock.

It is failing at: * User Story #18: When I first click the element with id="start_stop" , the timer should begin running from the value currently displayed in id="session-length" , even if the value has been incremented or decremented from the original value of 25.

As it appears, it is working properly, I cannot don’t see the bug. The timer starts at 25:00, and the text in "id=“session-length” is displayed in the right way. But I guess it does not start exactly from that point.
Can anyone take a look at my code?

Thank you so much

Set session length to say 2 mins and the break to 1 minute and click the “One” button. After a few seconds, click the “One” button again to pause the timer. Next, click the “Two” button which resets the break and sessions lengths to their default values, but then if you click the “One” button, you will notice the session time is not the same as the Session Length. When the reset button (button “Two”) is clicked, it should reset everything back to the original values, so the Session would should 25:00 and the Session Length would show 25:00

I am actually surprised you did not fail User Story #11.

That did it! Thank you mister!
Couple of 'undefined’s in the reset function, and it all works nicely. I spent most of the time figuring how the clock is supposed to work, and chasing seconds all over the place (I still believe that it’s not supposed to work this way when transitioning from session to break, I have an extra second when 01:00 is displayed right after 00:00). But nevertheless, all tests passing, and cert is awarded. I can finally move on, right after css polishing.

I still see this code as an absolute mess, and I need to work on my coding style and learn best practices. I see so many lines that I am absolutely sure I could’ve write better.
What are the improvements I can make to this code?
For example: totalSeconds calculation, inc/dec functions, intervalID in state? and that monstrous piece of code inside id="time-left" in render()

Best regards

You are correct about that being a bug. I have been meaning to report this ever since I first worked on this project. If you set the session time to 60:00 and break time to 1:00, you would technically be adding 1 min and 1 second extra time. Feel free to create an issue for this bug and I can post some video showing the issue.

1 Like