mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +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.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||||
if (item.quality > 0) {
|
if (item.quality > 0) {
|
||||||
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||||
item.quality = item.quality - 1;
|
updateQualityForExpiredItemNormal(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.quality = item.quality - item.quality;
|
updateQualityForExpiredItemBackstagePasses(item);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addQualityWhenWithInLimit(item);
|
addQualityWhenWithInLimit(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateQualityForExpiredItemBackstagePasses(Item item) {
|
||||||
|
item.quality = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateQualityForExpiredItemNormal(Item item) {
|
||||||
|
item.quality--;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateSellInDays(Item item) {
|
private void updateSellInDays(Item item) {
|
||||||
item.sellIn--;
|
item.sellIn--;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user