Skip to content

Glasgow | 26-ITP-May | Sandani Kannangara | Sprint 2 |Coursework#1366

Open
SandzSoft wants to merge 14 commits into
CodeYourFuture:mainfrom
SandzSoft:coursework/sprint-2
Open

Glasgow | 26-ITP-May | Sandani Kannangara | Sprint 2 |Coursework#1366
SandzSoft wants to merge 14 commits into
CodeYourFuture:mainfrom
SandzSoft:coursework/sprint-2

Conversation

@SandzSoft

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

Changelist

  • Fixed errors in existing code
  • Completed debugging exercises
  • Implemented new functions
  • Analysed and interpreted code behaviour
  • Added and ran test cases to verify solutions

@github-actions

This comment has been minimized.

@SandzSoft SandzSoft changed the title Coursework/sprint 2 Glasgow | 26-ITP-May | Sandani Kannangara | Sprint 2 |Coursework Jun 19, 2026
@SandzSoft SandzSoft added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. labels Jun 19, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code looks good. I just have a few suggestions.

// =============> Write your prediction here
//----------------------------------------------------------------------------------------------------------

const num = 103;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note: Deleting the global num is optional. Within the function block, num is resolved to the parameter num.
If you are interested in the topic, you can looking up these two concepts, identifier scope and
identifier resolution, in the context of JavaScript programming. ChatGPT can give a good explanation.

Comment on lines +7 to +8
if (hoursInt === 12)
return `${timeParts[0]}:${timeParts[1].padStart(2, "0")} pm`;

@cjyuan cjyuan Jun 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not use mins?

Code is correct. If time permits, you should try to refactor the code (in the whole function) to keep it cleaner.
It's a good practice.


Note: The usual practice for an if statement with a single statement in its body is:

if (condition) statement;

or

if (condition) {
    statement;    // Use braces when placing the statement on a separate line.
}

@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 Jun 23, 2026
@SandzSoft SandzSoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 24, 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 Jun 24, 2026
@SandzSoft SandzSoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 24, 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 Jun 24, 2026
@SandzSoft SandzSoft added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jun 24, 2026
@github-actions

This comment has been minimized.

@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 Jun 24, 2026
@cjyuan

cjyuan commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The validation bot is rejecting this PR because package.json in the top-level folder was modified. You need to revert the change made to that file to please the validation bot.

Reverting Changes

One way to revert changes to a file is via the git restore command.

First, locate a commit before the file was modified. It could be the first commit you made, assuming the branch started in a clean state.

Next, record the first 7 characters of the commit SHA.

Suppose the file is path/to/file, and you want to restore the file to its state before the commit with SHA 1234567.
The command is:

git restore --source=1234567^ path/to/file

After the file is restored, make a commit and push the changes to GitHub.

Ignore tracked file locally

In future PR, to ignore a tracked file such as package.json locally, use:

git update-index --skip-worktree path/to/file

And if you ever need undo the operation in order to track it again, use:

git update-index --no-skip-worktree path/to/file

This is commonly used for local configuration files that differ per developer.

@SandzSoft SandzSoft added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 24, 2026
@SandzSoft

Copy link
Copy Markdown
Author

The validation bot is rejecting this PR because package.json in the top-level folder was modified. You need to revert the change made to that file to please the validation bot.

Reverting Changes

One way to revert changes to a file is via the git restore command.

First, locate a commit before the file was modified. It could be the first commit you made, assuming the branch started in a clean state.

Next, record the first 7 characters of the commit SHA.

Suppose the file is path/to/file, and you want to restore the file to its state before the commit with SHA 1234567. The command is:

git restore --source=1234567^ path/to/file

After the file is restored, make a commit and push the changes to GitHub.

Ignore tracked file locally

In future PR, to ignore a tracked file such as package.json locally, use:

git update-index --skip-worktree path/to/file

And if you ever need undo the operation in order to track it again, use:

git update-index --no-skip-worktree path/to/file

This is commonly used for local configuration files that differ per developer.

Thank you for guiding me through GitHub. I’m still new to it, and your explanations have really helped me understand how fix it.

@cjyuan

cjyuan commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Changes look good.

Not everyone can use git on command line correctly. Well done!

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Module-Structuring-And-Testing-Data The name of the module. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants