Skip to content

Cape Town | 26-ITP-September | Sima Nongawuza | Sprint 3 | Coursework/sprint 3 - #1637

Open
simanongawuza wants to merge 11 commits into
CodeYourFuture:mainfrom
simanongawuza:coursework/sprint-3
Open

simanongawuza wants to merge 11 commits into
CodeYourFuture:mainfrom
simanongawuza:coursework/sprint-3

Conversation

@simanongawuza

@simanongawuza simanongawuza commented Oct 2, 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-1053

Changelist
-Completed all mandatory and stretch tasks for Sprint 3.
-Fixed bugs in the debugging exercises.
-Implemented the toPounds function.
-Added edge case tests for the time format exercise

@netlify

netlify Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cyf-onboarding-module ready!

Name Link
🔨 Latest commit 6407f1a
🔍 Latest deploy log https://app.netlify.com/projects/cyf-onboarding-module/deploys/6abfe4d782be5d0008b123f1
😎 Deploy Preview https://deploy-preview-1637--cyf-onboarding-module.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
2 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 86 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

This comment has been minimized.

@simanongawuza simanongawuza changed the title Cape Town | 26-ITP-September | Sima Nongawuza | Sprint 3 | Coursework/sprint-3 Cape Town | 26-ITP-September | Sima Nongawuza | Sprint 3 | Coursework/sprint 3 Oct 2, 2026
@github-actions

This comment has been minimized.

@simanongawuza simanongawuza added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 2, 2026
@hackertainment hackertainment 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 Oct 3, 2026

@hackertainment hackertainment 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.

Your work generally looks good to me. Just some minor English presentation issues which may affect accuracy or understanding. Most of my comments are just for your future reference and improvement.

You just need to give a reply to the following comments:

And code fix for the following comments:

Thank you for your effort, and keep it up.


// =============> write your explanation here

//The code runs but gives undefined in the console when we call the sum(10, 32). The return function is not defined. We must define it a + b so that when we call it, it give the sum of the 2 values

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Found a typo and should be "... The return value is not defined..." - because precisely speaking, the sum function itself is defined (in line 4) and the return itself is a built-in function (i.e. defined in JavaScript).

Comment on lines +32 to +33
// The const variable must be removed from the code. The computer reads that first and gives the same output for all console.log statements.
// A placeholder variable for num must be declared in the function parameter. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think line 33 would be a more accurate explanation. For line 32, even the const num variable is kept in the fixed code, the num.toString() in your function would still use the num in function parameter (when they are the same name). This is the concept of "scope of variable" in JavaScript (and other programming languages as well). So the key issue is "whether the function parameter exist or not", but not quite "whether the global constant variable removed or not".

//}
function calculateBMI(weight, height) {
squareHieght = height * height;
calculateBMI = Math.round(((weight / squareHieght)) *10 )/10;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

While your program produce the correct result, the ((weight / squareHieght)) used double brackets. This is not quite recommended - especially in socket programming, single pairs of bracket and double pairs of bracket may yield different results.

const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1);
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length -2);
const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length -2).padEnd(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.

Just to clarify a bit, why .padEnd(2, "0") is needed here?

Comment on lines +15 to +18
console.log(toPounds("399p"))
console.log(toPounds("10p"))
console.log(toPounds("1023p"))
console.log(toPounds("5p")) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your program looks generally ok to me. However, have you think of console.log(toPounds("0000000p")); and would it be the output you wanted? Just to give you a thought first and you don't need to fix the issue at this point, because you will learn more about designing test cases in the later module.

const hours = Number(time.slice(0, 2));
if (hours > 12) {
return `${hours - 12}:00 pm`;
const timeString = String(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.

Just wondering why this line is needed?

return `${time} am`;
const paddedHours = String(hours).padStart(2, "0");
const paddedMinutes = String(minutes).padStart(2, "0");
return `${paddedHours}:${paddedMinutes}${period}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Based on the original given targetedOutput (which has been deleted in your code), there should be a space before period (e.g. 08:00 am but not 08:00am).

Comment on lines +26 to +29
console.log(formatAs12HourClock("00:30"))
console.log(formatAs12HourClock("23:32"))
console.log(formatAs12HourClock("08:50"))
console.log(formatAs12HourClock("13:00"))

@hackertainment hackertainment Oct 4, 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.

Your test cases have covered am and pm. However, there are still 3 boundary cases which have not been covered yet. Can you think of them and add them too? Thank you.

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

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants