Ad
  • Default User Avatar

    pretty bad description, you say if pockets == nil i.e. if the first argument is nil, but what you really mean is if all the values in the hash are nil or empty arrays, or if the hash itself is empty.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • change the rank: nope, unless an admin goes by
    • average was surprisingly high, even for pus... (old kata). Anyway...
    • update: don't bother. Keeping the nil stuff will at least enforce something.
  • Custom User Avatar

    Eh, sorry, I wasn't getting notifications on this post for some reason and approved it before seeing your first comment. I published it with the power user average ranking (6kyu), since the overall average seemed a bit too high (5kyu). Are you sure it's too late to change the nil/empty array thing, though? The author's solution would have to be updated, but aside from that it's a minor change.

  • Custom User Avatar

    no, that won't change anything since currently that's the user who's converting the nils to an empty array (I mean... If the user coded it in a clever way... 'XD ). But yeah, that's what beta phase is made for, so go ahead. That way, I won't have second thoughts when approving it to 7 kyus. ;)

    EDIT: mmh damn... already approved... :( Then, keep it that way instead.

  • Custom User Avatar

    Agreed. I thought of doing that, but it would invalidate pretty much all of the existing solutions. Would that be ok?

  • Custom User Avatar

    what do you think about removing pockets being nil and replace them with an empty array instead? That would make way more sense, imo.

  • Custom User Avatar
    • Added sample tests
    • Fixed the code and description to change ints to single element arrays
  • Custom User Avatar
    • missing sample tests
    • the design of the pockets doesn't make sense: single items should be stored in a single element array
  • Custom User Avatar

    As far as the kata is right now the design is bad. Values of two semantics are mixed together with no way to tell between the both (not to mention exluding the option to have a price deduction of less than a dollar).

  • Custom User Avatar

    Bad kata design is still bad. Re-raising issue.

  • Custom User Avatar

    The result is suspect to floating point errors because no rounding is specified. e.g:

    should return 1 for order {:all=>100} and coupon {:value=>-0.99} -  Expected: 1, instead got: 1.0000000000000009
    
  • Custom User Avatar

    Order value should not be negative and should be rounded to two decimal points.

    The Order value should be rounded to two decimal points part is not tested.

  • Custom User Avatar

    Untrue. Gonna re-raise issue.

  • Default User Avatar

    Copied.

  • Loading more items...