mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 16:01:42 +00:00
cleanup
This commit is contained in:
parent
c86c945e1b
commit
6a54ec762c
@ -5,7 +5,7 @@ class Item {
|
|||||||
this.quality = quality;
|
this.quality = quality;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: You just started using the switch statement and increment variables. Uncomment the bottom code and run the tests to see the last working version.
|
|
||||||
class Shop {
|
class Shop {
|
||||||
constructor(items=[]){
|
constructor(items=[]){
|
||||||
this.items = items;
|
this.items = items;
|
||||||
@ -29,15 +29,14 @@ class Shop {
|
|||||||
itemSellIn--
|
itemSellIn--
|
||||||
break;
|
break;
|
||||||
case 'Backstage passes to a TAFKAL80ETC concert':
|
case 'Backstage passes to a TAFKAL80ETC concert':
|
||||||
let daysLeft = this.items[i].sellIn
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case (daysLeft < 0):
|
case (itemSellIn < 0):
|
||||||
itemQuality = 0
|
itemQuality = 0
|
||||||
break;
|
break;
|
||||||
case (daysLeft <= 5):
|
case (itemSellIn <= 5):
|
||||||
itemQuality += 3
|
itemQuality += 3
|
||||||
break;
|
break;
|
||||||
case (daysLeft <= 10):
|
case (itemSellIn <= 10):
|
||||||
itemQuality += 2
|
itemQuality += 2
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user