Skip to content

London | 26-ITP-SEPT | Abakar Souleyman | Sprint 3 | Alarm clock app - #1587

Open
abmhts wants to merge 4 commits into
CodeYourFuture:mainfrom
abmhts:module-Data-group/sprint-3/alarm-clock-app
Open

abmhts wants to merge 4 commits into
CodeYourFuture:mainfrom
abmhts:module-Data-group/sprint-3/alarm-clock-app

Conversation

@abmhts

@abmhts abmhts commented Nov 30, 2026

Copy link
Copy Markdown

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

Task code

CYF-1098

Changelist

Fixed alarm clock code

@abmhts abmhts added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 30, 2026
Comment thread Sprint-3/alarmclock/alarmclock.js Outdated

function setAlarm() {
clearInterval(timer); // stop any old countdown
timeLeft = Number(document.getElementById("alarmSet").value);

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 happens when Set Alarm is clicked with the number field left empty?

To "like" or "dislike" this comment, please follow this link

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot 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 Nov 30, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look.

@abmhts abmhts 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 Nov 30, 2026

@eliza-an eliza-an 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.

Really great job here! some little bits and pieces for you, nothing crucial. You dont have to make changes but i just left some comments for your future learning ! well done

Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
const minutes = Math.floor(timeLeft / 60);
const seconds = timeLeft % 60;
const text =
String(minutes).padStart(2, "0") + ":" + String(seconds).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.

This is a really good little piece of code, but as a developer, your main job is to ensure your code is clear and readable. I love that you named your variables "minutes" and "seconds" as it makes it easy to review, but could you maybe write this next bit clearer? Could we use variables and string concatination to do this? Have a look :)

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.

Thanks for the feedback! I've separated the formatting into variables to make the code clearer and easier to read.

clearInterval(timer);

const input = document.getElementById("alarmSet").value;
if (input.trim() === "") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

very interesting way of checking this!! Unusual but not bad!

Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
}
timeLeft = Number(input);

if (timeLeft <= 0 || !Number.isFinite(timeLeft)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

great checks here. \the only bit i would add is decimals as this happns!

image

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.

Good point, I hadn't considered decimal inputs. I'll add Number.isInteger() to make sure only whole numbers are accepted.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

image Excellent!

clearInterval(timer);

const input = document.getElementById("alarmSet").value;
if (input.trim() === "") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

very interesting way of checking this!! Unusual but not bad!

@eliza-an eliza-an 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 Dec 3, 2026
@abmhts abmhts 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 Dec 3, 2026
const text =
String(minutes).padStart(2, "0") + ":" + String(seconds).padStart(2, "0");

const formattedMinutes = String(minutes).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.

love this well done!

@eliza-an eliza-an 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 Dec 4, 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