Ad
  • Custom User Avatar

    Is not fixed in JS btw

  • Custom User Avatar

    Fixed

  • Custom User Avatar

    The user can modify the groceries.

  • Custom User Avatar

    First of all, I would like to say that I appreciate the people who spend time and create the katas.
    Thank you.
    I just want you to know that I am not just criticizing by posting this.
    I want to understand what is going on so I can attempt this kata.

    In general, I don't understand how the bogof items work. I know what it stands for. But, how can there ever be an odd amount for them? If you buy one, you get a free one. There is always an even number.

    Specifically: In the one example in the description, the amount for Chocolate is 5 and OJ is 15. This is supposed to return 26.25 according to the description. So, to work it out on paper...err...in the computer...whatever...

    OJ would be:
    15 .x 1.5 = 22.5
    22.5 - 2.25 (10% discount) = 20.25

    So, that means the Chocolate should cost $6. No discount amount.
    How is this calculated with a price of 2?
    The only thing I can figure out is that you would round up to the next integer for half of an odd item amount for a bogof item to solve this kata. So, you would use 3 for this test case.

  • Custom User Avatar

    Thank you. I passed the tests already

  • Custom User Avatar

    Hi- thanks for your feedback, have you now submitted a solution? If you are still having problems with the tests please let me know and I'll look into it.

  • Custom User Avatar

    Thanks for completing the kata! That's a great idea- I was definitely thinking of doing a more complicated version and increasing the difficulty.

  • Custom User Avatar

    PHP Translation Kumited - please carefully review and approve :D

  • Custom User Avatar

    I had fun with this but also some problems passing the random tests. Maybe is my code.

  • Custom User Avatar

    Nice kata! You could make an alternate version of this kata with duplicated items, and items not contained in the object list.

  • Custom User Avatar

    Great! Thanks for your help :)

  • Custom User Avatar

    Found it! There was still a reference to the subarray you added to the two arrays. I fixed your tests and now it works even with array manipulation :)

  • Custom User Avatar

    Well, it worked now. But you don't have to work with two arrays in this case. That didn't solve my problem. My initial solution also failed. I just removed the array manipulation of the input and now it works. Seems like I also changed the input array of your check solution, so the amount of every item with the attribut "bogof" is divided by 2. There is a reference somehow, but I don't know how to fix this.

  • Custom User Avatar

    Thanks- I think I've managed to track down the issue, it was relating to how the arrays were passed into the solution function and my testing function. It should now be fixed, could you try out your solution again and let me know if the expected values are now working for you?

  • Custom User Avatar

    Thanks! and many thanks for completing my kata :)

  • Loading more items...