Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unprecise description and solution for exercise 01 in chapter 03 #15

Open
mrvary opened this issue Jun 20, 2018 · 0 comments
Open

Unprecise description and solution for exercise 01 in chapter 03 #15

mrvary opened this issue Jun 20, 2018 · 0 comments

Comments

@mrvary
Copy link

mrvary commented Jun 20, 2018

There are some minor flaws in that excercise. Basically the solution provided does not match the logic that is suggested.

The exercise descriptions wants you to

[...] set the freeQty of each record using the following logic: Purchases of 5 or more receive 1 free. Purchases of 10 or more receive 3 free.

As I understand this, there are three cases here:

  1. with < 5 purchases you get 0 free items
  2. with at least 5 and < 10 purchases you get 1 free item
  3. with at least 10 and any more than that you get 3 free items

When I looked into the solution the logic behind it seems different, though. The implementation lets you get 3 free items for every 10 and 1 free item for every 5 purchases. The only issue is that if you already got any extra items for having a multiple of 10 purchases, you'll be missing out on another free item in case you have at least 5 more purchases remaining (because the free function checks freeQty == 0).

I'd love to fix it (would be my first PR 🎉 ), but what would be the prefered solution? I think the second way of solving this is a bit more difficult, how about splitting the first exercise into two?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant