diff --git a/js-jasmine/src/shop.js b/js-jasmine/src/shop.js index af529387..9bd50b6f 100644 --- a/js-jasmine/src/shop.js +++ b/js-jasmine/src/shop.js @@ -6,11 +6,18 @@ class Shop { } updateQuality() { for (var i = 0; i < this.items.length; i++) { - this._updateItemQuality(this.items[i]); + this._updateItem(this.items[i]); } return this.items; } + _updateItem(item) { + this._updateItemQuality(item); + this._updateItemSellIn(item) + this._checkMaxQuality(item); + this._checkMinQuality(item); + } + _updateItemQuality(item) { if (item.name == 'Backstage passes to a TAFKAL80ETC concert') { this._updateQualityBackstagePass(item); @@ -20,9 +27,6 @@ class Shop { } else { this._updateQualityStandard(item) } - this._updateSellIn(item) - this._checkMaxQuality(item); - this._checkMinQuality(item); } _updateQualityStandard(item) { @@ -53,7 +57,7 @@ class Shop { } } - _updateSellIn(item) { + _updateItemSellIn(item) { if (item.name != 'Sulfuras, Hand of Ragnaros') { item.sellIn = item.sellIn - 1; }