-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Glasgow_Class|Shreef_Ibrahim|Structuring _Testing _Datast|Week2_exercise2_update #236
base: main
Are you sure you want to change the base?
Glasgow_Class|Shreef_Ibrahim|Structuring _Testing _Datast|Week2_exercise2_update #236
Conversation
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 good in general. I left some comments and suggestions.
There are many typos and misspelled words in the comments. You can try using ChatGPT to help you improve them.
Sprint-2/errors/1.js
Outdated
const percentage = `${decimalNumber * 100}%`; | ||
|
||
return percentage; | ||
} | ||
// the decimalNumber has already been declared its constant cant except | ||
|
||
console.log(decimalNumber); |
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.
When you try executing this script, does it output 50%?
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.
Yes , when you execute console.log(convertToPercentage(0.5)) the output is 50%?
Sprint-2/extend/format-time.js
Outdated
@@ -21,4 +28,4 @@ const targetOutput2 = "11:00 pm"; | |||
console.assert( | |||
currentOutput2 === targetOutput2, | |||
`current output: ${currentOutput2}, target output: ${targetOutput2}` | |||
); | |||
); |
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.
- When you executed this script, does you notice any error message (caused by a bug in your program)?
- You can add additional tests to check if your function can return the expected value when times are "00:12", "12:59".
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.
I Missed : between hours and minutes, so I have updated it.
All these passed.
{ input: "01:00", expected: "1:00 am" },
{ input: "12:00", expected: "12:00 pm" },
{ input: "23:59", expected: "11:59 pm" },
{ input: "15:45", expected: "3:45 pm" },
{ input: "08:30", expected: "8:30 am" },
{ input: "00:00", expected: "12:00 am" },
{ input: "20:15", expected: "8:15 pm" },
Sprint-2/implement/bmi.js
Outdated
@@ -13,3 +13,7 @@ | |||
// Given someone's weight in kg and height in metres | |||
// Then when we call this function with the weight and height | |||
// It should return their Body Mass Index to 1 decimal place | |||
function calc(weigh,height){ | |||
const bmi = weigh/(height * height); | |||
return bmi.toFixed(1) |
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.
What is the type of value you expect to be returned from this function? A number or a string? Does your function return the type of value you expected?
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.
I added return parseFloat(bmi.toFixed(1)) now will return a number
const pounds = paddedPenceNumberString.substring( | ||
0, | ||
paddedPenceNumberString.length - 2 | ||
); | ||
const pence = paddedPenceNumberString | ||
.substring(paddedPenceNumberString.length - 2) | ||
.padEnd(2, "0"); | ||
return`£${pounds}.${pence}` |
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.
It is never too early to develop the habit to indent the code properly; it makes reading code easier.
function add_vat(price){ | ||
const vatRate = 1.2; | ||
const vatIncPri = price * vatRate | ||
return `£${vatIncPri.toFixed(2)}` |
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.
If we wanted to use the return value in calculation (e.g., total = add_vat(pricd1) + price2
) instead of for output purpose, how would you change the function?
Sprint-2/interpret/time-format.js
Outdated
@@ -9,23 +9,27 @@ function formatTimeDisplay(seconds) { | |||
const totalHours = (totalMinutes - remainingMinutes) / 60; | |||
|
|||
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad( | |||
remainingSeconds | |||
remainingSeconds. |
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.
Why add a .
here (line 12)?
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.
by mistake, while I'm pushing the code
|
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.