mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
Simplfied the conditional statements
This commit is contained in:
parent
f5328837f8
commit
edd3a27b96
@ -13,28 +13,18 @@ class ItemProcessor
|
|||||||
def update_item_quality
|
def update_item_quality
|
||||||
return if never_sold
|
return if never_sold
|
||||||
|
|
||||||
if (name != 'Aged Brie') && (name != 'Backstage passes to a TAFKAL80ETC concert')
|
|
||||||
decrease_item_quality
|
|
||||||
else
|
|
||||||
if quality < 50
|
|
||||||
quality += 1
|
|
||||||
if name == 'Backstage passes to a TAFKAL80ETC concert'
|
|
||||||
increase_item_quality if sell_in < 11
|
|
||||||
increase_item_quality if sell_in < 6
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
old_item
|
old_item
|
||||||
if sell_in < 0
|
|
||||||
if name != 'Aged Brie'
|
if name == 'Aged Brie'
|
||||||
if name != 'Backstage passes to a TAFKAL80ETC concert'
|
increase_item_quality
|
||||||
decrease_item_quality
|
increase_item_quality if sell_in < 0
|
||||||
else
|
elsif name == 'Backstage passes to a TAFKAL80ETC concert'
|
||||||
quality -= quality
|
increase_item_quality if sell_in < 11
|
||||||
end
|
increase_item_quality if sell_in < 6
|
||||||
else
|
quality -= quality if sell_in < 0
|
||||||
increase_item_quality
|
else
|
||||||
end
|
decrease_item_quality
|
||||||
|
decrease_item_quality if sell_in < 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user