Skip to content

Sheffield|May-2025|Sheida Shabankari|Module-Data -Groups| Sprint-3|Alarm Clock #631

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 9 commits into
base: main
Choose a base branch
from

Conversation

sheida-shab
Copy link

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

I have done all requirements for setting an alarm clock step by step and passed all the tests.

@sheida-shab sheida-shab added the Needs Review Participant to add when requesting review label Jul 16, 2025
Copy link
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.

  • Code works fine if a user only clicks the "Set Alarm" button once.
    However, if the user enters a time and then clicks the "Set Alarm" button multiple times, the countdown clock will not display properly.
    Can you fix the issue?

  • Some of the function definitions appear twice. Can you remove the unwanted copies?

  • We should respect instructions like DO NOT EDIT BELOW HERE; it is usually there for a reason. If you are curious about why, you can ask ChatGPT Why should programmers respect "DO NOT EDIT BELOW HERE" instruction in a file? (You don't have to undo the changes you made this time, I just want to raise your awareness)

@@ -1,5 +1,98 @@
function setAlarm() {}
var flashColor;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use var instead of let?

Comment on lines +6 to +9
if (inputTime <= 0 || isNaN(inputTime)) {
alert("invalid input!!!");
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Some unusual input values that can make your app behave abnormally can still pass this check. Can you add code to sanitise them?

Comment on lines +27 to +28
let min = String(Math.floor(inputTime / 60)).padStart(2, "0");
let sec = String(inputTime % 60).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.

Can consider declaring these two variables with const because they won't be reassigned any value.

Comment on lines +48 to +54
document.getElementById("stop").style.backgroundColor = "rgb(191, 115, 47)";
document.body.style.backgroundColor = "rgb(218, 178, 119)";
let flashColor=setInterval(() => {
if(document.body.style.backgroundColor === "rgb(218, 178, 119)"){
document.body.style.backgroundColor = "white";
}else{
document.body.style.backgroundColor = "rgb(218, 178, 119)";
Copy link
Contributor

Choose a reason for hiding this comment

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

Could consider preparing several CSS classes in a CSS file and then assign/remove CSS class to these element to change their appearance. This way, if we want to change the styles (including color), we don't have to modify the JS code.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jul 17, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants