Skip to content

London | 26-ITP-May | Russom Gebremeskel | Sprint 3 | Alarm Clock App - #1375

Open
russom-g wants to merge 50 commits into
CodeYourFuture:mainfrom
russom-g:sprint-3/alarmclock
Open

London | 26-ITP-May | Russom Gebremeskel | Sprint 3 | Alarm Clock App#1375
russom-g wants to merge 50 commits into
CodeYourFuture:mainfrom
russom-g:sprint-3/alarmclock

Conversation

@russom-g

@russom-g russom-g commented Aug 4, 2026

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

A set alarm function implemented in order to the alarm clock app to take minutes and seconds input, countdown, display, play sound and reset timer when countdown to 0.

russom added 30 commits July 16, 2026 20:57
@github-actions

This comment has been minimized.

@russom-g russom-g added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 4, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently when starting a new countdown, the application does not always return to a clean initial state, which can lead to inconsistent behaviour between runs.

Note: a user may not click the "Stop" button first before starting a new count down.

Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
Comment on lines +18 to +25
let minutes = Math.floor(time / 60);
let seconds = time % 60;

heading.innerText =
"Time Remaining: " +
String(minutes).padStart(2, "0") +
":" +
String(seconds).padStart(2, "0");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code on lines 18-25 is very similar to those on lines 6-13.
To adhere to the DRY principle in programming, could you refactor the repeated code into a reusable function?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. Good point. I implemented a new function called updateDisplay for displaying when the alarm is set first and for setInterval for displaying each second

Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
@@ -1,4 +1,35 @@
function setAlarm() {}
function setAlarm() {
let time = Number(document.getElementById("alarmSet").value);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any value the app should reject to ensure the app won't behave abnormally?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes non number or negative number. I added an if statement for checking those invalid inputs

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added another if condition with clearIntervals. This is for return to a clean initial state when a new alarm is set.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants