This commit is contained in:
Karim Fadel 2026-01-14 08:42:53 +02:00
parent 60d41e79e1
commit 0155b204a2

View File

@ -23,7 +23,7 @@ public class Item {
decreaseSellInEachDay();
if (sellIn < 0) {
if (isExpired()) {
increaseQualityByOne();
}
} else if (isBackstagePasses()) {
@ -31,7 +31,7 @@ public class Item {
decreaseSellInEachDay();
if (sellIn < 0) {
if (isExpired()) {
quality = 0;
}
} else {
@ -39,12 +39,16 @@ public class Item {
decreaseSellInEachDay();
if (sellIn < 0) {
if (isExpired()) {
decreaseQualityByOne();
}
}
}
private boolean isExpired() {
return sellIn < 0;
}
boolean isBackstagePasses() {
return name.equals(BACKSTAGE_PASSES);
}