mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 07:51:29 +00:00
Flatten conditionals
This commit is contained in:
parent
b0c4797e66
commit
a06e221197
@ -19,22 +19,16 @@ export class GildedRose {
|
|||||||
|
|
||||||
updateQuality() {
|
updateQuality() {
|
||||||
this.items.forEach((item, i) => {
|
this.items.forEach((item, i) => {
|
||||||
if (item.name == 'Aged Brie' || item.name == 'Backstage passes to a TAFKAL80ETC concert') {
|
if (item.name === 'Sulfuras, Hand of Ragnaros') {
|
||||||
if (item.name == 'Aged Brie') {
|
// Do Nothing
|
||||||
this.incrementQuality(item);
|
} else if (item.name == 'Aged Brie') {
|
||||||
}
|
this.incrementQuality(item);
|
||||||
|
} else if (item.name == 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
if (item.name == 'Backstage passes to a TAFKAL80ETC concert') {
|
this.incrementQuality(item);
|
||||||
this.incrementQuality(item);
|
if (item.sellIn < 11) this.incrementQuality(item)
|
||||||
if (item.sellIn < 11) this.incrementQuality(item)
|
if (item.sellIn < 6) this.incrementQuality(item)
|
||||||
if (item.sellIn < 6) this.incrementQuality(item)
|
} else if (item.quality > 0) {
|
||||||
}
|
item.quality = item.quality - 1
|
||||||
} else {
|
|
||||||
if (item.quality > 0) {
|
|
||||||
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
|
||||||
item.quality = item.quality - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
||||||
item.sellIn = item.sellIn - 1;
|
item.sellIn = item.sellIn - 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user