mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 07:51:29 +00:00
Completed first run through of refactor
This commit is contained in:
parent
cef9e3f900
commit
934400d37c
@ -16,31 +16,23 @@ class GildedRose(object):
|
|||||||
|
|
||||||
def update_quality(self):
|
def update_quality(self):
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert":
|
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros":
|
|
||||||
self.adjust_quality(item)
|
|
||||||
|
|
||||||
else:
|
|
||||||
if item.quality < 50:
|
|
||||||
self.adjust_quality(item, 1)
|
|
||||||
if item.name == "Backstage passes to a TAFKAL80ETC concert":
|
|
||||||
if item.sell_in < 11:
|
|
||||||
if item.quality < 50:
|
|
||||||
self.adjust_quality(item, 1)
|
|
||||||
if item.sell_in < 6:
|
|
||||||
if item.quality < 50:
|
|
||||||
self.adjust_quality(item, 1)
|
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros":
|
if item.name != "Sulfuras, Hand of Ragnaros":
|
||||||
item.sell_in = item.sell_in - 1
|
item.sell_in -= 1
|
||||||
if item.sell_in < 0:
|
|
||||||
if item.name != "Aged Brie":
|
if item.name == "Aged Brie":
|
||||||
if item.name != "Backstage passes to a TAFKAL80ETC concert":
|
self.adjust_quality(item, 1) if item.sell_in >= 0 else self.adjust_quality(item, 2)
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros":
|
return
|
||||||
self.adjust_quality(item)
|
|
||||||
else:
|
if item.name == "Backstage passes to a TAFKAL80ETC concert":
|
||||||
item.quality = 0
|
if item.sell_in <= 10 and item.sell_in > 5:
|
||||||
|
return self.adjust_quality(item, 2)
|
||||||
|
elif item.sell_in > 0 and item.sell_in <= 5:
|
||||||
|
return self.adjust_quality(item, 3)
|
||||||
else:
|
else:
|
||||||
self.adjust_quality(item, 1)
|
item.quality = 0
|
||||||
|
return
|
||||||
|
|
||||||
|
self.adjust_quality(item) if item.sell_in >= 0 else self.adjust_quality(item, -2)
|
||||||
|
|
||||||
|
|
||||||
class Item:
|
class Item:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user