Skip to content

ZA | ITP-MAY-25 | Shannon Davids | Data Groups-Sprint-3 | AlarmClock #758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Shannon-Davids
Copy link

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@Shannon-Davids Shannon-Davids added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 11, 2025
Comment on lines 7 to 12
const mins = Math.floor((sec % 3600) / 60);
const secs = sec % 60;
return `${String(hrs).padStart(2, "0")}:${String(mins).padStart(
2,
"0"
)}:${String(secs).padStart(2, "0")}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this function needed in the app? If not, it should be removed to keep the code clean.

Comment on lines 31 to 37
if (timeRemaining <= 0) {
clearInterval(countdownInterval);
updateDisplay();
playAlarm();
} else {
updateDisplay();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Regardless of the condition on line 31, the app is going to call updateDisplay(). So we could factor out the function call and call the function once outside the if block.

Comment on lines 16 to 24
const input = document.getElementById("alarmSet");
const seconds = parseInt(input.value);

if (isNaN(seconds) || seconds <= 0) {
alert("Please enter a valid number of seconds.");
return;
}

clearInterval(countdownInterval); // Stop any existing countdown
Copy link
Contributor

Choose a reason for hiding this comment

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

Could also consider stopping the flashing background and the alarm sound when a new countdown 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 11, 2025
@Shannon-Davids Shannon-Davids added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 11, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Aug 12, 2025

Changes look good!

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and all review comments have been addressed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants