Skip to content

Dagim H.#11

Open
Unlock7 wants to merge 2 commits intoHackYourAssignment:mainfrom
Unlock7:main
Open

Dagim H.#11
Unlock7 wants to merge 2 commits intoHackYourAssignment:mainfrom
Unlock7:main

Conversation

@Unlock7
Copy link

@Unlock7 Unlock7 commented Mar 11, 2026

complete task 1 & 2: bash scripts and API filtering!

@github-actions
Copy link

📝 HackYourFuture auto grade

Assignment Score: 100 / 100 ✅

Status: ✅ Passed
Minimum score to pass: 50
🧪 The auto grade is experimental and still being improved

Test Details
Vitest unit test results:

✅ post.sh: Script exists
✅ post.sh: Create user John Doe
✅ patch.sh: Script exists
✅ patch.sh: Correct the email address
✅ get.sh: Script exists
✅ get.sh: Retrieve user John Doe details
✅ delete.sh: Script exists
✅ delete.sh: Delete user John Doe
✅ get.sh: Verify user John Doe has been deleted
✅ Uses the correct base URL
✅ URL includes the nobelPrizeYear query parameter
✅ URL includes the nobelPrizeCategory query parameter
✅ URL includes the offset query parameter
✅ URL includes the limit query parameter
✅ Omits the nobelPrizeYear when set to "all"
✅ Omits the nobelPrizeCategory when set to "all"
✅ Includes the sort query parameter set to desc

Total passed: 17
Total failed: 0
Killed

@remarcmij remarcmij self-assigned this Mar 11, 2026
Copy link

@remarcmij remarcmij left a comment

Choose a reason for hiding this comment

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

Hi @Unlock7, all is working well. The implementation of the last exercise, while working correctly, could be made simpler to understand. See my comment below.

Comment on lines +22 to +25
...(filters.year !== "all" && { nobelPrizeYear: filters.year }),
...(filters.category !== "all" && {
nobelPrizeCategory: filters.category,
}),

Choose a reason for hiding this comment

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

I had to do a double-take before I understood what this code does. In this case, I would prefer simpler code that I can understand at first glance. It may be a bit longer but with less chance of brain-fry.

  const params = new URLSearchParams({
    offset: filters.offset || 0,
    limit: filters.limit || 10,
    sort: "desc",
  });
  // console.log(params)

  if (filters.year !== "all") {
    params.append("nobelPrizeYear", filters.year);
  }

  if (filters.category !== "all") {
    params.append("nobelPrizeCategory", filters.category);
  }

 const url = `${API_BASE_URL}/nobelPrizes?${params.toString()}`;

Copy link
Author

Choose a reason for hiding this comment

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

Hi @remarcmij
Thanks for your time and for showing me the alternative approach! I’ll keep readability in mind, but I also think this version looks quite clean. I appreciate the feedback!😊

@remarcmij remarcmij added the Reviewed This assignment has been reivewed by a mentor and a feedback has been provided label Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants