mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-11 04:31:21 +00:00
<long method>: crear metodo para actualizar calidad de item
This commit is contained in:
parent
1dbf58aca7
commit
a697fad530
@ -26,25 +26,29 @@ class GildedRose
|
|||||||
item.name == "Aged Brie"
|
item.name == "Aged Brie"
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_quality()
|
def update_item_quality(item)
|
||||||
@items.each do |item|
|
if !aged_brie?(item) and !backstage_pass?(item)
|
||||||
if !aged_brie?(item) and !backstage_pass?(item)
|
if item.quality > 0
|
||||||
if item.quality > 0
|
decrease_quality(item)
|
||||||
decrease_quality(item)
|
end
|
||||||
end
|
else
|
||||||
else
|
if item.quality < 50
|
||||||
if item.quality < 50
|
increase_quality(item)
|
||||||
increase_quality(item)
|
if backstage_pass?(item)
|
||||||
if backstage_pass?(item)
|
if item.sell_in < 11
|
||||||
if item.sell_in < 11
|
increase_quality(item)
|
||||||
increase_quality(item)
|
end
|
||||||
end
|
if item.sell_in < 6
|
||||||
if item.sell_in < 6
|
increase_quality(item)
|
||||||
increase_quality(item)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_quality()
|
||||||
|
@items.each do |item|
|
||||||
|
update_item_quality(item)
|
||||||
if !legendary?(item)
|
if !legendary?(item)
|
||||||
item.sell_in = item.sell_in - 1
|
item.sell_in = item.sell_in - 1
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user