London |ITP- Jan-2026| Damian Dunkley |Sprint 3 |Alarm Clock app#1028
London |ITP- Jan-2026| Damian Dunkley |Sprint 3 |Alarm Clock app#1028DamianDL wants to merge 15 commits intoCodeYourFuture:mainfrom
Conversation
|
There is a requirement to update the title of the page to |
There was a problem hiding this comment.
Completely optional and can be personal preference but we might have over-commented some of the lines, some comments are genuinely useful and are great to document code but others might be consider self explanatory.
There was a problem hiding this comment.
I think you're right about style- I have put most of the comments in as a reminder to myself when I look at it again- not very neat and collaborative, but useful for me while I'm learning and possibly reusing in future modules. If there's a better or more standard way of doing that, I'm happy to comply? Thanks
There was a problem hiding this comment.
Hey @DamianDL , typically when we raise PRs, we would only keep comments for things that really aren't obvious from the code alone, like context or complicated implementation that would require that extra info (ideally the code self-documents what we are trying to do with proper variable and function names), but for learning purposes I don't feel too strongly against keeping them.
| clearInterval(countdownId); | ||
| countdownId = null; | ||
| playAlarm(); | ||
| document.body.style.backgroundColor = "red"; // change background colour |
There was a problem hiding this comment.
This is an awesome touch, minor point is that when the background becomes red, then a new timer could reset it back to the original background (until it's done counting and it goes back to red). How can we implement that?
There was a problem hiding this comment.
Reset screen to white when timer set.
Sprint-3/alarmclock/alarmclock.js
Outdated
| } | ||
|
|
||
| function setAlarm() { | ||
| const input = document.getElementById("alarmSet");// Get the input element using its DOM ID |
There was a problem hiding this comment.
Completely optional, can we add some guards against edge cases such as empty input, negative values, and (potentially) 0? Everything would trigger an alarm right away with the current implementation.
There was a problem hiding this comment.
Updated edge cases of 0 and -1 to not accept inputs.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Let's address the github action @DamianDL |
|
Github action addressed- I hope. Passing script and I hope all changes to alarmclock.js retained. Thanks |
Sprint-3/alarmclock/alarmclock.js
Outdated
| // Clear the alarm timeout if it exists | ||
| if (alarmTimeoutId !== null) { | ||
| clearTimeout(alarmTimeoutId); | ||
| alarmTimeoutId = null; | ||
| } |
There was a problem hiding this comment.
Can you think of a way of doing this without editing below the DO NOT EDIT BELOW HERE line?
Sprint-3/alarmclock/alarmclock.js
Outdated
|
|
||
| function updateHeading(totalSeconds) { | ||
| // Update the heading with the formatted time remaining | ||
| const heading = document.getElementById("timeRemaining"); // Get the heading element using its DOM ID |
There was a problem hiding this comment.
We are calling this function on every "tick", which grabs the heading from the DOM. How can we make sure the heading is only queried/selected once and reused instead?
There was a problem hiding this comment.
Used a cache wrapper set getTimeRemainingHeading function line 5 and reuse line 21 function.
|
We are also missing the page title |
Sprint-3/alarmclock/alarmclock.js
Outdated
| @@ -1,4 +1,68 @@ | |||
| function setAlarm() {} | |||
| let countdownId = null; | |||
| let alarmTimeoutId = null; // Track the alarm timeout to clear it if needed | |||
There was a problem hiding this comment.
Alarm Timeout Id removed from code
Sprint-3/alarmclock/alarmclock.js
Outdated
|
|
||
| function updateHeading(totalSeconds) { | ||
| // Update the heading with the formatted time remaining | ||
| const heading = document.getElementById("timeRemaining"); // Get the heading element using its DOM ID |
|
Some comments from yesterday weren't addressed including the page title. |
…removal of alarmtimeoutID, which was not doing anything
|
The title was reverted back again @DamianDL |
Learners, PR Template
Self checklist
Changelist
Updated code to :
Questions
Please review for Data Groups module?