You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
with < 5 purchases you get 0 free items
with at least 5 and < 10 purchases you get 1 free item
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?
The text was updated successfully, but these errors were encountered:
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
As I understand this, there are three cases here:
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?
The text was updated successfully, but these errors were encountered: