6 kyu

Shop Inventory Manager

82 of 288GiacomoSorbi
Description
Loading description...
Debugging
  • Please sign in or sign up to leave a comment.
  • zdreagin Avatar

    The description says "the quality of an item can never be negative or increase beyond 50". Both of these limits are not true (and not just in cases where the item is "Sulfuras"), as in the tests, some items start with quality values that are negative, while others start with quality values that are above 50. For clarification, this Kata tests that quality values above 50 should be reduced if necessary, but should otherwise not be altered, and negative quality values are changed to 0 the first time they are encountered, and then increased as indicated by the other requirements.

    (I have seen the issue of items with an initial quality value greater than 50 pointed out by other commenters, but haven't seen anyone point out the negative quality value issue.)

  • Krillan Avatar

    Part of the description of the kata is poorly worded and misleading, namely:

    "the quality of an item can never be negative or increase beyond 50"

    It should be replaced with (the author himself gave this explanation at the very bottom in response to old comments, but for some reason did not correct the description):

    "cannot increase above 50: if it was already 56, it will either go down or stay 56, according to the category; just not increase."

  • AlekseiNosov Avatar

    To be honest, i cant understand what is going on with random tests. Description says that quality cant be higher that 50(if item isnt "Sulfurus") but it in tests they may be higher and i have no idea how to finish solution. That is a very intresting kata but broken (Imho) (JS)

  • Campell Avatar

    The description is a total mess so is Item class. It is hard to write anything useful without changing it.

    Some products starts with sell_in above 50 or quality below 0. Nowhere in the description is it specified what should be done with it. Moreover Item constructor should be prepared for it and fix those numbers if neccessary or they should never apear!

    Random test are almost useless, without a way of repeating specific product you need to brute-force them in order to check every case. Special edge cases should be described or be taken into fixed tests!

    Starting code is a total mess it is better without it. Also without the access to Item class it is hard to make it close to domain model so I didn't even bother.

    I had high hopes for this kata but it wasn't anything good.

  • FArekkusu Avatar

    The tests shouldn't log anything. The "checking item...", "N days passed", "comparing sell_in/quality" info should be a single error message.

  • FArekkusu Avatar

    Considering how atrociously bad and broken the initial solution is, you could save everybody the trouble of thinking that it could be debugged, and remove it.

  • FArekkusu Avatar

    There should be fixed tests with backstage passes having a sell_in equal to the number of passed days.

  • FArekkusu Avatar

    the quality of an item can never be negative or increase beyond 50

    Sometimes items have an initial quality > 50.

  • user9644768 Avatar

    Ruby 3.0 should be enabled.

  • DMG6 Avatar

    Hi GiacomoSorbi

    I am trying this Kata in Java.

    I am failling in the random test in the Backstage passes.

    the input values are for example:

    quality: 72 Selling: 42

    Expected different value expected:<72> but was:<50>

    I missing something there? I was thinking that we cannot have Qualities over 50 apart from "Sulfuras"

    Thnaks in advance

  • marcinoleksiak Avatar

    I think there's still problem with this kata. In the description it's said: Just for extra clarification, an item can never have its quality increase above 50, however "Sulfuras" is a legendary item and as such its quality is 80 and it never alters.

    And here's a part of log from random tests: Starting items in the store are {Very Aged Brie, 2, 60}, {Potion of Weak Love, 6, 58} and 5 days passed Checking item 1: Very Aged Brie Test Passed Not the expected quality value: 50 should equal 60

    According to the description only sulfuras can have quality >50. Besides - 5 days passed condition and quality raised by 2 each day.. where it is said? Please, verify requirements vs tests.

    Python

  • Voile Avatar

    items is shared and used globally and this is broken due to the new runner.

  • Voile Avatar

    Tests use xrange so it's Python 2 only.

  • rantiev Avatar

    Contains ambiguities in the description.

  • Sir Montes Avatar

    Why is test for "Backstage passes to a TAFKAL80ETC concert", sellIn=11, quality=20 failed? The test expects sellIn=10, quality=22 but according to requirements should be there sellIn=10, quality=21. Am I right?

  • apap Avatar

    This comment has been hidden.

  • lechevalier Avatar

    @GiacomoSorbi here's the original link for Gilded Rose Refactoring Kata, including translations for many programming languages.

    May you put it into description instead of the current one?

  • animusanima Avatar

    Can someone point out the mistake I had in my object oriented solution? It fails the random tests, while the last solution passes everything with waved flags.

    I've put all the parts from the last one into the object oriented attempt and it still fails. I'm a bit confused and would be thankful for some clarification.

  • animusanima Avatar

    Maybe I get this wrong, but as stated in the instructions the quality of an item can't be greater than 50.

    In your random tests though the following test case failed:

    test_randomItems(ShopInventoryManagerTests) Testing 11 random items after 8 days. Testing: +5 Conjured Vest of Hoggie Testing: +15 Aged brie Sword of Sargaras ✘ Expected different value expected:<72> but was:<50>

    I had this a couple of times and double (and triple) checked all the cases. I passed due to a lucky random test case scenario.

    Can you please check my solution if I made a mistake and passed by accident?

    Greets David

  • yashaRO Avatar

    Amount of failed tests keeps changing, hard to know what to change if the program doesn't even know how to read.

  • Hw597 Avatar

    I am new to programming and enjoy using these kata as practice for the concepts I am picking up.
    How long does it take people to solve this kata. I realise I will speed up as I am more familiar with the material. But I would like some idea of the benchmark I should be shooting for. I can't imagine in interview/ work scenario's i'd be given the amount of time it takes me.

  • mafelix Avatar

    I don't think you're wording the backstage conditions correctly or they are not very clear:

    Here's what I understood from it at the beginning: Backstage should increase in quality += 1 every sell in If backstage sell ins are <=10 they should increase by 2 instead If backstage sell in are <=5 they should increase by 3 instead end

    Here you have a backstage with 7sell in, 9 quality. Let's count the sell ins. 7=>6 increase by 2 quality = 11 6=>5 increase by 2 quality = 13 5=>4 increase by 3 quality = 16 4=>3 increase by 3 quality = 19!!!!!!!!!!

    Thats 4 days. Where the final sell in/day is ending at 3. Going from 7>6>5>4. 2 of those days should be +2 each. The other 2 should be +3 each. I know the answer it's testing for is +quality: 2,3,3,3 But the wording is very vague and confusing.

    Starting items in the store are {Conjured Goblin Axe +5, 7, 13}, {Canned Laughters, 9, 12}, {Priss and the Replicants Backstage Passes, 7, 9}, {Conjured Goblin Axe +5, 9, 38}, {Zero Zone Kevlar Vest +1, 8, 22} and 4 days passed

    OUTPUT: Checking item 3: Priss and the Replicants Backstage Passes Test Passed: Value == 3 Not the expected quality value - Expected: 20, instead got: 19

  • franna Avatar

    This had me chewing my pen up -.- . One i had the Brie increase X2 below 0 as the other items decreased x2. Dug myself a grave there :)

  • phuse2 Avatar

    Nice kata I enjoyed this one. Just a suggestion on the problem description and/or order of operations:

    When calculating the change in value for an item on a given day you first need to decrement the "sell in" field. So for instance to calculate whether a product will decay twice as fast, you actually need to check if the sell in field is equal to one at the start of the loop for the day. I think this should be made clear in the problem description, or personally I would change it. The way the problem description is written seems to imply that the change in daily quality values are calculated using the current "sell in" value.

  • qed2000 Avatar

    Hi,

    I enjoyed the Kata, but wanted to raise an issue. Since the tests are random, it is possible that an incorrect solution will be accepted and appear in the solved answers portion. I had an answer that came up with a failed test and resubmitted my answer to see if other tests would fail when it came up passing all tests. I then attempted to rerun it but all the tests passed and my answer was accepted. Rather than offering randomized tests, you should make sure your tests cover all acceptance criteria. The purpose of a kata isn't to trick the participant or show that you can be more clever. The instructions should be clear and the tests should be complete and consistent. To that end, as a native English speaker and a linguist, I agree that the use of "the quality of an item can never be negative or increase beyond 50" is ambiguous, as it doesn't address what should happen if the value is already above 50. The instructions do imply that the value cannot exceed 50 - particularly since this is supposed to be a replacement for the existing store management system, which should have also followed these rules. As it is written, it is hard to imagine anyone successfully completing this kata without receiving feedback from the test results. Thanks!

  • Anu003 Avatar

    This comment has been hidden.

  • fenring76 Avatar

    I am a native English speaker.

    "the quality of an item can never ... increase beyond 50;"

    This states plainly that an item cannot increase from 50 to >50, but does not specify behavior when an item's quality begins above 50.

    "Just for extra clarification, an item can never have its quality increase above 50"

    This statement is ambiguous. It could be technically be read as intended, but the typical native English speaker is likely to read it to mean an item's quality cannot cross (in the positive direction) the threshold of 50.

    This really, really, really needs to be reworded. If these were verbatim quotes from an interview, then the interview itself was flawed. (Or perhaps part of the interview was a test to see if the candidate will seek clarification in cases of an ambiguous specification.)

  • alessandrodalbello Avatar

    Values can't never increase beyond 50, aside Sulfuras, but from tests I found that backstage passes are already beyond 50. I think that description should be more clear.

  • lwiyninger-mdsol Avatar

    It wasn't clear from the description that values already above 50 should stay there.

  • hilary Avatar

    another great one :)

  • nickie Avatar

    The description should be more clear w.r.t. three things:

    • what exactly "cannot be increased above 50" means? If it is already 56 and you try to increase it, what happens?
    • same for "become negative".
    • saleIn < 0 (or <= 10, <= 5, etc.), before or after decreasing it?
  • g964 Avatar

    @GiacomoSorbi: Excuse me to write here but I have problems with 2 katas of which you certainly are the Python and/or Ruby translator. I marked an issue on each one but I think you won't be notified. http://www.codewars.com/kata/difference-between-biggest-2-numbers/discuss/python http://www.codewars.com/kata/new-gps-system/discuss/python

    Sorry if I am too tired and don't see some evidence! I apologize to bother you in your own land:-)

  • ZozoFouchtra Avatar

    Giake ! . . .

    10K - 5 ! ! ! ! ! ? ? ? no . . . over 10 K !!!!!!!

    Oh my Code !!!

    ( Is it a bird ? Is it a plane ? Nope, it's super-Giake ! )

  • MMMAAANNN Avatar

    Offtopic: Giacomo, how can I contact you for personal matter?

  • Darnor Avatar

    If there are any issues/questions/suggestions about the Java version, leave a comment here. :-)

  • Darnor Avatar

    Very nice kata. Had a lot of fun solving it. :-)

    (And congrats on the interview and #1 too of course!)

  • ChristianECooper Avatar

    This comment has been hidden.

  • ZozoFouchtra Avatar

    This comment has been hidden.

  • sayfidz Avatar

    Creative, fun kata... although as I re-read the instructions, it seems that I was supposed to fix the code that was there rather than start from scratch. Oops. I might have to redo it properly. Regardless, congrats on the interview and on reaching #1.

  • ZozoFouchtra Avatar

    This comment has been hidden.