mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 23:41:27 +00:00
[WIP] Refactor gilded rose
This commit is contained in:
parent
11fd218253
commit
2ce80ae337
@ -18,52 +18,54 @@ export class GildedRose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateQuality() {
|
updateQuality() {
|
||||||
for (let i = 0; i < this.items.length; i++) {
|
this.items.map(this.updateItemQuality);
|
||||||
if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
return this.items;
|
||||||
if (this.items[i].quality > 0) {
|
}
|
||||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
|
||||||
this.items[i].quality = this.items[i].quality - 1
|
private updateItemQuality(item) {
|
||||||
}
|
if (item.name != 'Aged Brie' && item.name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
}
|
if (item.quality > 0) {
|
||||||
} else {
|
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
||||||
if (this.items[i].quality < 50) {
|
item.quality = item.quality - 1
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
|
||||||
if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') {
|
|
||||||
if (this.items[i].sellIn < 11) {
|
|
||||||
if (this.items[i].quality < 50) {
|
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.items[i].sellIn < 6) {
|
|
||||||
if (this.items[i].quality < 50) {
|
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
} else {
|
||||||
this.items[i].sellIn = this.items[i].sellIn - 1;
|
if (item.quality < 50) {
|
||||||
}
|
item.quality = item.quality + 1
|
||||||
if (this.items[i].sellIn < 0) {
|
if (item.name == 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
if (this.items[i].name != 'Aged Brie') {
|
if (item.sellIn < 11) {
|
||||||
if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
if (item.quality < 50) {
|
||||||
if (this.items[i].quality > 0) {
|
item.quality = item.quality + 1
|
||||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
|
||||||
this.items[i].quality = this.items[i].quality - 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.items[i].quality = this.items[i].quality - this.items[i].quality
|
|
||||||
}
|
}
|
||||||
} else {
|
if (item.sellIn < 6) {
|
||||||
if (this.items[i].quality < 50) {
|
if (item.quality < 50) {
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
item.quality = item.quality + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
||||||
return this.items;
|
item.sellIn = item.sellIn - 1;
|
||||||
|
}
|
||||||
|
if (item.sellIn < 0) {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user