Build a 25 + 5 Clock

Hi there,
Please I have almost completed the front-end development project Build a 25 + 5 Clock but I can’t pass three (03) tests out of 29. I have been trying to find the bug for several days now but I haven’t got any clue why these tests are not passing. I have used react and redux but I have not extracted state to redux yet. Here is the codepen link:

https://codepen.io/billjay/pen/LYoVWKR

Here are the tests which are failing:
User Story #23: When a session countdown reaches zero (NOTE: timer MUST reach 00:00), a new break countdown should begin, counting down from the value currently displayed in the id="break-length" element.

User Story #25: 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.

User Story #27: The audio element with id="beep" must be 1 second or longer.

I have added code to read values from from the various html elements and I am replaying the sound when it ends to make it above 1 second but the test does not pass.

Please help me find out the issue!

Welcome to the forum @Billjay

I had a quick look at your timer.

The format needs to be mm:ss

So for example, 7:00 for session timer will fail the tests. It needs to be 07:00

Happy coding

I changed the topic from General to JavaScript

Thanks Teller,
It’s a pleasure being part of this great forum.

I will try to implement your suggestions and test the results. I appreciate it.

What about the “beep” sound failing test, what can I do to make the test pass. I don’t have a URL to an audio which is longer than 1 second.

Use your favourite search engine to search for "beep sound effects"

There are also sound generators available online which create sounds \ beeps \ tones. Doing it this way, you will need a place to host them. I used GitHub to store a logo for a RWD project.

Happy coding

Hi Teller,
Thanks for your support. Unfortunately I tried your suggestions and I am still failing the tests. I still have 26/29. I expected two of the failing tests to pass but they are still failing. Please I have done a lot of research and I am overwhelmed. Please help me resolve this issue.

Here is the link to the codepen :
https://codepen.io/billjay/pen/LYoVWKR

For the beep sound, I will try your proposed solution and see if it works.

I have passed the test for sound by doing online research and using a sound I found on a cool website.

But I still have two tests which are failing. Please help me resolve the issue.
P

Hi @Billjay

Some of the code is not quite right.

              const breakLengthString = 
                document.getElementById('break-length').innerHTML;

Your app should not get values from the DOM.

Also, the break time for 1 minute starts from 59 seconds.

Happy coding

Hi Teller,

Okay you are right I should not be reading from DOM but I just changed to this after the code was failing to see if it will work. I was reading break length from state

let breakMinutesInMs = clock.breakLength * 60 * 1000;

Frankly I don’t understand “the break time for 1 minute starts from 59 second”. Please clarify me.

I have actually exahausted all my ideas on this code. Please try to run the tests with your corrections and see if the tests actually pass. I am somehow lost right now. If you assure me that the tests passes, then I will try to figure out the solution.

Thanks a lot for your support and patience

Hi @Billjay
Here is a video showing, near the end, the timer jumping from 00:00 to 00:59
timer

This is a certification project, so you’ll need to experiment a bit, and find ways to resolve issues. If you’d like some feedback, please post your updated code so the forum can assist.

Okay Teller,

I can see how it jumps. I will try to go through my code again and see what is going on.

At least I am glad you guys are always there to support me. I will give you feedback.

1 Like

Woooow Teller,

Thank you very much for giving me that tip and pushing me to the limit. I finally figured out why the clock was jumping from 00:00 to 00:59.

I passed the test and it now shows 29/29. I am so grateful for this great forum and freeCodeCamp. It has increased my motivation to continue and I am counting on your continuous support.

Thanks again!

1 Like