Skip to content

Salem Ba-Rabuod#19

Open
Barboud wants to merge 3 commits intoHackYourAssignment:mainfrom
Barboud:main
Open

Salem Ba-Rabuod#19
Barboud wants to merge 3 commits intoHackYourAssignment:mainfrom
Barboud:main

Conversation

@Barboud
Copy link
Copy Markdown

@Barboud Barboud commented Mar 28, 2026

No description provided.

@github-actions

This comment has been minimized.

@remarcmij remarcmij self-assigned this Mar 28, 2026
@github-actions

This comment has been minimized.

Copy link
Copy Markdown

@remarcmij remarcmij left a comment

Choose a reason for hiding this comment

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

Hi @Barboud , see my comments below with regard to Task 1. The code of that you originally submitted as your PR for me to review could never have worked because of the reasons I explained in Slack. I consider that a submission that was not tested by yourself.

Comment thread task-1/Time.js
@@ -1,3 +1,65 @@
export class Time {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It is best to define these constants outside of the class definition so that you can use them in all methods, not just the constructor.

Suggested change
export class Time {
const SECONDS_IN_MINUTE = 60;
const SECONDS_IN_HOUR = SECONDS_IN_MINUTE * 60;
const SECONDS_IN_DAY = SECONDS_IN_HOUR * 24;
export class Time {

Comment thread task-1/Time.js Outdated
Comment on lines +6 to +7
const SECONDS_IN_HOUR = 3600;
const SECONDS_IN_MINUTE = 60;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use the suggested constants defined at the file level.

Suggested change
const SECONDS_IN_HOUR = 3600;
const SECONDS_IN_MINUTE = 60;

Comment thread task-1/Time.js Outdated
const totalSeconds =
hours * SECONDS_IN_HOUR + minutes * SECONDS_IN_MINUTE + seconds;

if (totalSeconds < 0 || totalSeconds >= 86400) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

86400 is a magic number.

Suggested change
if (totalSeconds < 0 || totalSeconds >= 86400) {
if (totalSeconds < 0 || totalSeconds >= SECONDS_IN_DAY) {

Comment thread task-1/Time.js Outdated
}

getHours() {
return Math.floor(this.#secondsFromMidnight / 3600);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
return Math.floor(this.#secondsFromMidnight / 3600);
return Math.floor(this.#secondsFromMidnight / SECONDS_IN_HOUR);

Comment thread task-1/Time.js Outdated
}

getMinutes() {
return Math.floor((this.#secondsFromMidnight % 3600) / 60);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
return Math.floor((this.#secondsFromMidnight % 3600) / 60);
return Math.floor((this.#secondsFromMidnight % SECONDS_IN_HOUR) / SECONDS_IN_MINUTE);

Comment thread task-1/Time.js Outdated
}

getSeconds() {
return this.#secondsFromMidnight % 60;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Check the rest of this class for magic number and replace them with the predefined constants.

Comment thread task-1/Time.js Outdated
Comment on lines +55 to +65
const myTime = new Time(12, 35, 0);
console.log(myTime.toString()); // 12:35:00
myTime.getHours(); // 12
myTime.getMinutes(); // 35
myTime.getSeconds(); // 0

myTime.addMinutes(25);
console.log(myTime.toString()); // 13:00:00

myTime.addHours(12);
console.log(myTime.toString()); // 01:00:00
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To make this class reusable, this file should only define the class itself. These statements belong to the index.js file.

Suggested change
const myTime = new Time(12, 35, 0);
console.log(myTime.toString()); // 12:35:00
myTime.getHours(); // 12
myTime.getMinutes(); // 35
myTime.getSeconds(); // 0
myTime.addMinutes(25);
console.log(myTime.toString()); // 13:00:00
myTime.addHours(12);
console.log(myTime.toString()); // 01:00:00

@remarcmij remarcmij added the Reviewed This assignment has been reivewed by a mentor and a feedback has been provided label Mar 29, 2026
@github-actions
Copy link
Copy Markdown

📝 HackYourFuture auto grade

Assignment Score: 0 / 100 ✅

Status: ✅ Passed
Minimum score to pass: 0
🧪 The auto grade is experimental and still being improved

Test Details

@Barboud
Copy link
Copy Markdown
Author

Barboud commented Mar 29, 2026

Hi @Barboud , see my comments below with regard to Task 1. The code of that you originally submitted as your PR for me to review could never have worked because of the reasons I explained in Slack. I consider that a submission that was not tested by yourself.

Hi @remarcmij , I’ve updated the code for Task 1 and addressed the issues you mentioned. For task 2, I’ve also thoroughly tested it on my end to ensure everything is working correctly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants