mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Code Refactoring :Separated expired item quality check based on item type to improve readability.
This commit is contained in:
parent
e5625734e5
commit
f576dd8f49
@ -60,18 +60,25 @@ class GildedRose {
|
||||
if (!item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (item.quality > 0) {
|
||||
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
item.quality = item.quality - 1;
|
||||
updateQualityForExpiredItemNormal(item);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.quality = item.quality - item.quality;
|
||||
updateQualityForExpiredItemBackstagePasses(item);
|
||||
}
|
||||
} else {
|
||||
addQualityWhenWithInLimit(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateQualityForExpiredItemBackstagePasses(Item item) {
|
||||
item.quality = 0;
|
||||
}
|
||||
|
||||
private void updateQualityForExpiredItemNormal(Item item) {
|
||||
item.quality--;
|
||||
}
|
||||
|
||||
private void updateSellInDays(Item item) {
|
||||
item.sellIn--;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user