mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 07:51:29 +00:00
Extract sellInBelow0
This commit is contained in:
parent
ab6be24de4
commit
e734b35f3a
@ -46,24 +46,28 @@ export class GildedRose {
|
|||||||
item.sellIn = item.sellIn - 1;
|
item.sellIn = item.sellIn - 1;
|
||||||
}
|
}
|
||||||
if (item.sellIn < 0) {
|
if (item.sellIn < 0) {
|
||||||
if (item.name != 'Aged Brie') {
|
this.sellInBelow0(item);
|
||||||
if (item.name != 'Backstage passes to a TAFKAL80ETC concert') {
|
|
||||||
if (item.quality > 0) {
|
|
||||||
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
|
||||||
item.quality = item.quality - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
item.quality = item.quality - item.quality
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (item.quality < 50) {
|
|
||||||
item.quality = item.quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return this.items;
|
return this.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sellInBelow0(item: Item) {
|
||||||
|
if (item.name != 'Aged Brie') {
|
||||||
|
if (item.name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
|
if (item.quality > 0) {
|
||||||
|
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
||||||
|
item.quality = item.quality - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
item.quality = item.quality - item.quality;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (item.quality < 50) {
|
||||||
|
item.quality = item.quality + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user