Skip to content

London | 26-ITP-May | Vito Moratti | Sprint 3 | Alarm-clock - #1384

Open
vmoratti wants to merge 9 commits into
CodeYourFuture:mainfrom
vmoratti:Module-Data-Groups/alarmclock
Open

London | 26-ITP-May | Vito Moratti | Sprint 3 | Alarm-clock#1384
vmoratti wants to merge 9 commits into
CodeYourFuture:mainfrom
vmoratti:Module-Data-Groups/alarmclock

Conversation

@vmoratti

@vmoratti vmoratti commented Aug 6, 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

Completed implementation of the alarm clock

@vmoratti vmoratti added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 6, 2026
@hey-hammad hey-hammad added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 8, 2026

@hey-hammad hey-hammad left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • If the user clicks "Stop Alarm" before the timer reaches 00:00, what happens to the countdown? Will the alarm still ring when the timer finishes?
  • Could formatTime() do its job by returning the formatted time instead of relying on and updating global variables?

@hey-hammad hey-hammad added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 8, 2026
Refactor formatTime function to accept remainingSeconds as a parameter and return formatted time string. Update alarm display logic to use the new formatTime function.
@vmoratti

vmoratti commented Aug 9, 2026

Copy link
Copy Markdown
Author

I have now made the recommended adjustments.

@vmoratti vmoratti added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 9, 2026
@hey-hammad hey-hammad added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 10, 2026

@hey-hammad hey-hammad left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice effort fixing the application state, few changes required regarding code quality.

Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
//5. starts timer
clearInterval(timer);
remainingSeconds = Number(document.getElementById("alarmSet").value);
if (remainingSeconds === 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a reason we're handling 0 and negative values separately here? Since both cases seem to represent invalid input, would it make sense to use a single validation check and provide user feedback (e.g., an alert/message) instead?

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 have addressed that issue

Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
} else if (remainingSeconds < 0) {
return clearInterval(timer);
}
formatTime();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What's the purpose of the standalone formatTime() call here? It looks like the return value isn't used, and the formatted value is already generated in the next line.

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.

done

remainingSeconds = remainingSeconds - 1;
alarmDisplay.textContent = `Time Remaining: ${formatTime(remainingSeconds)}`;
}
function stopTimer() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is stopTimer() still needed? I don't see it being called anywhere.

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.

the stopTime() function is being used by HTML file on line 16 by "Stop alarm" button.

@hey-hammad hey-hammad added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 10, 2026
@vmoratti vmoratti added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 10, 2026
@vmoratti vmoratti added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 10, 2026
@hey-hammad hey-hammad added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 11, 2026
alarmDisplay.textContent = `Time Remaining: ${formatTime(remainingSeconds)}`;
timer = setInterval(updateDisplay, 1000);
}
function changeBackground() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is it possible to make this function act like a toggle? Currently it turns red and doesn't return to the original state when setting a new alarm.

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 have made the adjustments to accommodate that

@hey-hammad hey-hammad added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 11, 2026
@vmoratti vmoratti added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 11, 2026
@hey-hammad hey-hammad added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. 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. Reviewed Volunteer to add when completing a review with trainee action still to take. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 12, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants