mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
correct bug: condition on sellIn for Backstage should be lower than 10 and 05 instead of 11 or 06
This commit is contained in:
parent
1aae554b54
commit
a273600de7
@ -19,6 +19,20 @@ class GildedRose {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateNumberOfdayToSellRemaining(Item item) {
|
||||||
|
item.sellIn -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean itemHasExpired(Item item) {
|
||||||
|
boolean condition;
|
||||||
|
if (item.sellIn < 0) {
|
||||||
|
condition=true;
|
||||||
|
} else {
|
||||||
|
condition=false;
|
||||||
|
}
|
||||||
|
return condition;
|
||||||
|
}
|
||||||
|
|
||||||
public void updateQuality() {
|
public void updateQuality() {
|
||||||
String SULFURA = "Sulfuras, Hand of Ragnaros";
|
String SULFURA = "Sulfuras, Hand of Ragnaros";
|
||||||
String AGED_BRIE = "Aged Brie";
|
String AGED_BRIE = "Aged Brie";
|
||||||
@ -30,24 +44,26 @@ class GildedRose {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.name.equals(AGED_BRIE) || item.name.equals(BACKSTAGE)) {
|
updateNumberOfdayToSellRemaining(item);
|
||||||
|
|
||||||
|
if (item.name.equals(AGED_BRIE)) {
|
||||||
increaseQuality(item);
|
increaseQuality(item);
|
||||||
if (item.name.equals(BACKSTAGE)) {
|
} else if (item.name.equals(BACKSTAGE)) {
|
||||||
if (item.sellIn < 11) {
|
increaseQuality(item);
|
||||||
increaseQuality(item);
|
|
||||||
}
|
if (item.sellIn < 10) {
|
||||||
if (item.sellIn < 6) {
|
increaseQuality(item);
|
||||||
increaseQuality(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (item.sellIn < 5) {
|
||||||
|
increaseQuality(item);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
decreaseQuality(item);
|
decreaseQuality(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
item.sellIn = item.sellIn - 1;
|
|
||||||
|
|
||||||
|
if (itemHasExpired(item)) {
|
||||||
if (item.sellIn < 0) {
|
|
||||||
if (item.name.equals(AGED_BRIE)) {
|
if (item.name.equals(AGED_BRIE)) {
|
||||||
increaseQuality(item);
|
increaseQuality(item);
|
||||||
} else if (item.name.equals(BACKSTAGE)) {
|
} else if (item.name.equals(BACKSTAGE)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user