mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-12 13:11:49 +00:00
r rename func
This commit is contained in:
parent
0539c92082
commit
13dde323cb
@ -9,22 +9,11 @@ class Item:
|
|||||||
|
|
||||||
|
|
||||||
def update_item(item: Item):
|
def update_item(item: Item):
|
||||||
if is_sulfuras(item):
|
if should_do_nothing(item):
|
||||||
return
|
return
|
||||||
|
|
||||||
if is_backstage_pass(item):
|
if is_backstage_pass(item):
|
||||||
if item.quality < 50:
|
return update_backstage_pass(item)
|
||||||
item.quality = item.quality + 1
|
|
||||||
if item.sell_in < 11:
|
|
||||||
if item.quality < 50:
|
|
||||||
item.quality = item.quality + 1
|
|
||||||
if item.sell_in < 6:
|
|
||||||
if item.quality < 50:
|
|
||||||
item.quality = item.quality + 1
|
|
||||||
item.sell_in = item.sell_in - 1
|
|
||||||
if item.sell_in < 0:
|
|
||||||
item.quality = item.quality - item.quality
|
|
||||||
return
|
|
||||||
|
|
||||||
if is_aged_brie(item):
|
if is_aged_brie(item):
|
||||||
if item.quality < 50:
|
if item.quality < 50:
|
||||||
@ -56,9 +45,24 @@ def is_aged_brie(item: Item):
|
|||||||
return item.name == "Aged Brie"
|
return item.name == "Aged Brie"
|
||||||
|
|
||||||
|
|
||||||
def is_sulfuras(item: Item):
|
def should_do_nothing(item: Item):
|
||||||
return item.name == "Sulfuras, Hand of Ragnaros"
|
return item.name == "Sulfuras, Hand of Ragnaros"
|
||||||
|
|
||||||
|
|
||||||
def is_backstage_pass(item: Item):
|
def is_backstage_pass(item: Item):
|
||||||
return item.name == "Backstage passes to a TAFKAL80ETC concert"
|
return item.name == "Backstage passes to a TAFKAL80ETC concert"
|
||||||
|
|
||||||
|
|
||||||
|
def update_backstage_pass(item: Item):
|
||||||
|
if item.quality < 50:
|
||||||
|
item.quality = item.quality + 1
|
||||||
|
if item.sell_in < 11:
|
||||||
|
if item.quality < 50:
|
||||||
|
item.quality = item.quality + 1
|
||||||
|
if item.sell_in < 6:
|
||||||
|
if item.quality < 50:
|
||||||
|
item.quality = item.quality + 1
|
||||||
|
item.sell_in = item.sell_in - 1
|
||||||
|
if item.sell_in < 0:
|
||||||
|
item.quality = item.quality - item.quality
|
||||||
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user