Skip to content

London | 26-ITP-May | Anita Amirhaeri | Sprint 3 | Alarm Clock - #1388

Open
anitahy73 wants to merge 3 commits into
CodeYourFuture:mainfrom
anitahy73:sprint3/alarmclock
Open

London | 26-ITP-May | Anita Amirhaeri | Sprint 3 | Alarm Clock#1388
anitahy73 wants to merge 3 commits into
CodeYourFuture:mainfrom
anitahy73:sprint3/alarmclock

Conversation

@anitahy73

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

Sprint 3 | Alarm Clock

Questions

Implemented alarm countdown functionality with display update.
Updated the HTML structure and title for the alarm clock app.
@anitahy73 anitahy73 added 📅 Sprint 3 Assigned during Sprint 3 of this module 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 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.

A few observations from testing:

  • The timer accepts negative and decimal values. What should happen when such values are entered?
  • When the alarm is set multiple times, could this leave multiple intervals running or put the application into an unexpected state?
  • What happens to the active countdown when the user stops the alarm before it reaches 0?

@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
Sanitize input and handle negative values in alarm clock.
@anitahy73 anitahy73 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 12, 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 15, 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, however multiple code quality and validation issues needs to be addressed. Thanks


function setAlarm() {
// sanitize input: convert to number, floor to integer seconds, clamp to >= 0
let timeInput = Math.floor(Number(input.value) || 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.

What would happen If I set the alarm for unexpected values such as an empty string or 0?


// handle negative input explicitly
const rawValue = Number(input.value);
if (rawValue < 0) {

@hey-hammad hey-hammad Aug 15, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since we've already type casted and validated the input above is there a need to do this here again?

let minutes = Math.floor(timeInput / 60);
let seconds = timeInput % 60;

minutes = minutes.toString().padStart(2, "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.

the formatting logic is duplicated, can we extract out this logic into a function to remove code duplication?

@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 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Data-Groups The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants