Skip to content

Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 3 | alarm clock#1113

Open
mshayriyesaricicek wants to merge 5 commits intoCodeYourFuture:mainfrom
mshayriyesaricicek:Sprint-3-Alarm-Clock-App-Clean
Open

Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 3 | alarm clock#1113
mshayriyesaricicek wants to merge 5 commits intoCodeYourFuture:mainfrom
mshayriyesaricicek:Sprint-3-Alarm-Clock-App-Clean

Conversation

@mshayriyesaricicek
Copy link
Copy Markdown

Self checklist

  • [XI 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

Created function for alarmclock

@mshayriyesaricicek mshayriyesaricicek added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Groups The name of the module. labels Mar 27, 2026
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

  • You missed updating index.html according to an instruction in readme.md.

  • Currently, when the input is either 0 or 1, the alarm will sound 1 second afterward (a bit inconsistent).

@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 Mar 28, 2026
@mshayriyesaricicek mshayriyesaricicek 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 Apr 1, 2026
@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 Apr 1, 2026
@mshayriyesaricicek mshayriyesaricicek 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 Apr 2, 2026
@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 Apr 3, 2026
@mshayriyesaricicek mshayriyesaricicek 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 Apr 5, 2026
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

The app is working.

If you have time, I would suggest practice refactoring the code to reduce the amount duplicated code.

Comment on lines +101 to +114
// stops countdown amd stops audio
if (countdownIntervalId) {
clearInterval(countdownIntervalId);
countdownIntervalId = null;
}
alarmRunning = false; // mark that alarm is no longer active
alarmRinging = false; // mark that alarm sound is no longer playing
pauseAlarm(); // stop audio if it's playing

const timerDisplay = document.getElementById("timeRemaining");
updateTimerDisplay(timerDisplay, 0);

document.getElementById("alarmSet").value = ""; // clears input field when stopped
});
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.

Why not just call resetAllStates()?

Comment on lines +46 to +53
// Prevent starting a new alarm if one is already running
if (alarmRunning) {
alert("Please press Stop before setting a new alarm."); // ensues user cannot set another alarm without stopping the current one first
return;
}
if (alarmRinging) {
resetAllStates(timerDisplay); // stop previous alarm and reset states
}
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan Apr 6, 2026

Choose a reason for hiding this comment

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

Could also just always call resetAllStates() without checking any flags. The logic is not quite the same but doing so can simplify the application logic (lesss amount of code).

With one function call, you can remove the codes on line 46-53, 63-66, and you probably won't need alarmRinging and alarmRunning.

Comment on lines +81 to +87
clearInterval(countdownIntervalId); // stops the countdown timer
countdownIntervalId = null; // resets timer ID

alarmRunning = false; // mark that alarm is no longer active
alarmRinging = true; // mark that alarm sound is currently playing

updateTimerDisplay(timerDisplay, 0); // shows zero time
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.

Could also consider replacing this code by resetAllStates().
Even though resetAllStates() is doing more than necessary, it's ok to trade slight inefficiency for simplicity.

@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 Apr 6, 2026
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. Module-Data-Groups The name of the module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants