-
-
Notifications
You must be signed in to change notification settings - Fork 238
Glasgow | 25-ITP-SEP | Mohammed Abdoon | Sprint 2 | Coursework #725
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
base: main
Are you sure you want to change the base?
Conversation
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. |
2 similar comments
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. |
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. |
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. |
1 similar comment
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. |
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is clean and clear. I just have a few suggestions.
Regarding the PR description, the Self-checklist should be a list of items with checkboxes; you removed the boxes. (Look up "how to represent checked boxes in Markdown")
let BMI = weight/squaredHeight; | ||
BMI = BMI.toFixed(1); | ||
return Number(BMI); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you notice the variables squaredHeight
and BMI
are rendered in different colors?
Many IDEs and viewers that support syntax highlighting (including GitHub) display identifiers in different formats and colors. Can you find out why?
let bmi, camelCase;
let Bmi, PascalCase;
let BMI, UPPER_SNAKE_CASE;
Can you look up the naming conventions in JavaScript? In particular,
- Variable and function names
- Class and Types names
- Named constants
Then, update the variable names according to those conventions.
// # The Python visualizer stops working when it runs pad because (padStart is not a function), maybe because it uses ES6 version of javascript! | ||
// The return value of pad when it's called for the first time is 00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A common convention for indicating that a value is a string is to enclose it in double quotes. For example, "00".
currentOutput = formatAs12HourClock("00:37"); | ||
targetOutput = "00:37 am"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you look up the 12-hour clock equivalents of the 24-hour times "00:37" and "12:37"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good.
Please note that in CYF courses, the recommended way to inform the reviewer of your changes is to do both of the following:
- Reply to their feedback.
- In the responses, clarify how each piece of feedback was addressed to demonstrate that you've carefully reviewed the suggestions.
- You may find the suggestions in this PR Guide useful.
- Your response may trigger a notification (depending on the reviewer's settings), helping ensure they’re aware of the updates you’ve made.
- In the responses, clarify how each piece of feedback was addressed to demonstrate that you've carefully reviewed the suggestions.
- Replace the "Reviewed" label by a "Needs review" label (which you have done -- great!)
- Without this label, the reviewer would not know if your changes is ready to be reviewed.
let hours = time.slice(0, 2); | ||
let minutes= time.slice(3, 5); | ||
let timeIndicator; | ||
|
||
if (Number(hours) >= 12) { | ||
hours = String(hours - 12); | ||
hours = hours.padStart(2, "0"); | ||
timeIndicator = "pm"; | ||
} else { | ||
timeIndicator = "am"; | ||
} | ||
return `${time} am`; | ||
if ( hours === "00") | ||
hours = "12"; | ||
|
||
return `${hours}:${minutes} ${timeIndicator}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On lines 10-11: Mixing numbers and strings can be dangerous.
A better approach could be:
- Convert
hours
to a number once at the beginning - Carry out calculation using only numbers in the function body (no type conversion needed)
- At line 20, call
.padStart()
once to formathours
as a 2-digit string.
Ok, I do that for the next PL reviews, thank you so much. |
Learners, PR Template
Self checklist
Changelist
I have completed all the exercises and worked through errors, debugging, implementations, interpretations, and practicing handling time formats.