Skip to content

EMIN AKTURK | BIRMINGHAM | MODULE-DATA-GROUPS - SPRINT 2 #763

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

eminakturk
Copy link

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

I am aware of the indented coursework where you could see sprint 1 fixes as well, I'm aware of the situation I will be fixing it with my next module PR.

@eminakturk eminakturk added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 13, 2025
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.

  • Can you revert the changes made in the Sprint-1 folder to keep this branch clean?

  • Why not practice "committing files one by one, on purpose, and for a reason"?
    In VSCode, you can select which file to stage, and commit only the staged file.
    See: https://www.youtube.com/watch?v=z5jZ9lrSpqk&t=705 (At around 12:50 minute marker, the video shows how to stage a single file).


function contains(obj, prop) {
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) return false;
return Object.prototype.hasOwnProperty.call(obj, prop);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could also call Object.hasOwn(obj, prop);

Comment on lines +35 to +37
test("contains with array input returns false", () => {
expect(contains([1, 2, 3], "a")).toBe(false);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

contains([1, 2, 3], "a") could also return false because "a" is not a property (or key) of [1, 2, 3].
However, "0", "1", "2" are keys of [1, 2, 3], so it is better to specify the test as
expect(contains([1, 2, 3], "1")).toBe(false); (to ensure you are checking what you describe)

queryParams[key] = value;
const idx = pair.indexOf('=');
if (idx > -1) {
const key = pair.slice(0, idx);
Copy link
Contributor

Choose a reason for hiding this comment

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

Value in key could also be URL encoded.

if (idx > -1) {
const key = pair.slice(0, idx);
const value = pair.slice(idx + 1);
if (key === "equation") {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is so special about the string "equation"?

Comment on lines 4 to 8
const counts = {};
for (const item of arr) {
counts[item] = (counts[item] || 0) + 1;
}
return counts;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the following function call returns the value you expect?

tally(["toString", "toString"]);

Suggestion: Look up an approach to create an empty object with no inherited properties.

@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 Aug 13, 2025
@eminakturk
Copy link
Author

Hello CJ,
I have added fixes for the errors you have found.

I'm afraid while I was creating new branches every time, I did not go back to main branch so It created indented branches, that's why It is how it is, I did not fix it for this one because I have to redo everything from beginning which as you know we dont have enough time, I'm dealing with TV project at the same time, If that wouldn't be a big problem for you I would appreciate if you could tag it as completed as if you are happy with the code too. As I said I know where the problem is and won't do it again like that.

@eminakturk eminakturk added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 13, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Aug 13, 2025

You can use these commands to rebase your coursework-sprint-2 branch onto main.

This instructions assume you had created a branch named B2 from a branch named B1 instead of from main, and you wanted to rebase B2 from B1 onto main.

In your case, B1 is coursework-sprint1 and B2 is coursework-sprint-2.

Important:

  • You need to execute the commands within your cloned repository.
  • You may want to backup your files before trying these commands
  • All changes made up to Step 3 do not affect what you have on GitHub.

1. Open Your Cloned Repository in VSCode and Start a Terminal in VSCode.

VSCode will start the terminal in the top-level folder of the current project.

2. Switch to the branch you want to rebase (B2)

git switch B2

Note:

  • You can check which branch is the current branch via the command git branch (to list all branches with current branch highlighted)

3. Rebase B2 from B1 onto main

git rebase --onto main B1 B2

For more details about this command, ask an AI tool or see
https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase#:~:text=interactive%20rebase%20display-,Advanced%20rebase%20application,-The%20command%20line

4. Update (and Overwrite) your files in the remote branch B2 (on Github)

While you are in branch B2 and you have verified that it has been successfully rebased, execute the following command to update the remote branch (on GitHub):
git push --force origin

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.

Changes look good. I will mark this PR as complete first so you don't have to worry about the commands I suggested for rebasing your branch.

@@ -10,10 +10,15 @@ function parseQueryString(queryString) {
if (idx > -1) {
const key = pair.slice(0, idx);
const value = pair.slice(idx + 1);
if (key === "equation") {

if (key === "equation" || key === "formula" || key === "expression" || value.includes('=')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why threat these cases differently?

@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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 13, 2025
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants