Skip to content

London | 26-ITP-Jan | Boualem Larbi Djebbour | sprint 1 | Coursework#1090

Open
djebsoft wants to merge 30 commits intoCodeYourFuture:mainfrom
djebsoft:coursework/sprint-1
Open

London | 26-ITP-Jan | Boualem Larbi Djebbour | sprint 1 | Coursework#1090
djebsoft wants to merge 30 commits intoCodeYourFuture:mainfrom
djebsoft:coursework/sprint-1

Conversation

@djebsoft
Copy link

@djebsoft djebsoft commented Feb 27, 2026

Learners, PR Template

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

Changelist

I completed the mandatory sections of sprint 1 for the second module

Questions

Updated comment to clarify the assignment operation.
Updated the initials variable to dynamically generate initials from first, middle, and last names.
Implemented logic to extract directory and extension from filePath.
Added comments to explain the purpose and behavior of the num variable and the random number generation process.
Changed 'const' to 'let' for age variable to allow reassignment.
Fix variable declaration order to avoid reference error.
Updated last4Digits assignment to convert cardNumber to a string before slicing.
Updated variable names to avoid starting with digits.
Fixed syntax error in priceAfterOneYear assignment and updated comments.
Added comments to explain the purpose of each step in the code.
@github-actions

This comment has been minimized.

@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 27, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 27, 2026
@djebsoft djebsoft changed the title London | 26-ITP-Jan Boualem Larbi Djebbour | sprint 1 | Coursework London | 26-ITP-Jan | Boualem Larbi Djebbour | sprint 1 | Coursework Feb 27, 2026
@github-actions

This comment has been minimized.

@djebsoft djebsoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 27, 2026
Updated the capitalise function to fix variable redeclaration and corrected the return variable name.
Declare 'result' with 'let' to avoid redeclaration error.
…ge function

Removed duplicate declaration of decimalNumber and updated comments.
Corrected the square function to properly accept a parameter and return its square.
Refactored multiply function to include return statement and improved logging.
Fix the sum function to correctly return the sum of two numbers.
Corrected the getLastDigit function to accept a parameter and return the last digit of a number.
Added a function to convert a string to upper snake case.
Updated comments in time-format.js to clarify the behavior of the pad function.
Removed comments with answers to questions about the pad function.
djebsoft added 7 commits March 1, 2026 22:15
Refactor toPounds function for reusability and clarity.
Removed the upperSnakeCase function implementation and example call.
Fix the sum function to return the correct result.
Corrected the square function to properly accept a parameter and return its square.
Updated comments to clarify errors and provide explanations.
Removed duplicate variable declaration and fixed typo in return statement.
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

I noticed some inconsistency in the formatting of the code.

Consider install prettier VSCode extension and enable formatting on save/paste on VSCode as recommended in
https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/blob/main/readme.md


const dir = ;
const ext = ;
const dir = filePath.slice(0,lastSlashIndex+1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you intend to include a trailing / in the value assigned to dir?

Comment on lines +23 to +24
const lastPointIndex = filePath.lastIndexOf(".");
const ext = filePath.slice(lastPointIndex+1);
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach is better because it works for extensions of any length.

Comment on lines +11 to +20
// the num represents a value with limited interval and that's why
// the num assigned to a value that's in the dor of an expression
// the math object is invoked to perform some mathematical tasks
// the random method is invoked to get a random number between 0 and 1
// the random number is multiplied by 100
// the floor method is invoked to round down the result to its nearest integer
// added one to the new result
// the final result of the whole expression is what the variable num assigned to
/* after applying the program several times, I got the idea that the program is generating
a value to the num variable thats always between minimum an maximum*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Phrases like "a number between X and Y" are not precise enough in a program specification, because they do not clearly state whether the endpoints X and Y are included.

We can also use the concise and precise interval notation to describe a range of values.

  • [, ] => inclusion
  • (, ) => exclusion

For example, [1, 10) means, all numbers between 1 and 10, including 1 but excluding 10.

@@ -1,9 +1,18 @@
const cardNumber = 4533787178994213;
const last4Digits = cardNumber.slice(-4);
const last4Digits = (cardNumber.toString()).slice(-4);
Copy link
Contributor

Choose a reason for hiding this comment

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

Dot operator is evaluated from left to right. So the parentheses around cardNumber.toString() is optional, and is usually omitted.

const $12HourClockTime = "20:53"; // or any change that makes the identifier not stating with digit
const _24hourClockTime = "08:53"; // identifier can not begin with a number
// or
const $24hourClockTime = "08:53"; // or any change that makes the identifier not stating with digit
Copy link
Contributor

Choose a reason for hiding this comment

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

Starting a variable name with a $ is generally not recommended.

Normal practice is to begin a variable name with a lowercase letter.


// e) What do you think the variable result represents? Can you think of a better name for this variable?
// it represents the length of the movie in hours, minutes and seconds format
// a better name would be: movieTimeVolume
Copy link
Contributor

Choose a reason for hiding this comment

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

The name movieTimeVolume does not quite indicate the value stored in the variable
is a formatted string in the form "2:12:02".

Can you suggest a more descriptive name?

// line 3: calling substring method to remove the 'p' letter and keep only digits in the string
// line 8: using padstart method to make the minimum length of the string to 3 characters by adding one zero or two to the left.
// line 9: using substring method to take only the integer part
// line 14: using substring method to take only the decimal part and padend method to make the minimum length of pence to 2 characters by adding zero to the right
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional challenge:
Could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code?
In other words, do we really need .padEnd(2, "0") in this script?

Copy link
Contributor

Choose a reason for hiding this comment

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

There should not be modified files in the Sprint-2 folder in a PR created for Sprint-1 exercise.

Can you revert (undo) the changes made in the Sprint-2 folder?

@cjyuan cjyuan 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 Mar 5, 2026
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

The changed files in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the changed files tab at the top of the page, we are only expecting changes in this directory: ^Sprint-1/

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

1 similar comment
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

The changed files in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the changed files tab at the top of the page, we are only expecting changes in this directory: ^Sprint-1/

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

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