fix: fix the negative number logic

This commit is contained in:
sirlolcat 2022-06-04 23:43:09 +04:30
parent 58f35a4fd5
commit 6818eda220
2 changed files with 2 additions and 12 deletions

View File

@ -28,14 +28,10 @@ function calculateQuality(state: TItem): number {
}
}
if(state.isConjured) {
if(state.isConjured || state.sellIn < 0) {
degradeRate = 2;
}
if(state.sellIn <= 0) {
return calculatedQuality;
}
calculatedQuality = calculatedQuality - (qualityIdentifier * degradeRate);
if(calculatedQuality > 50) {

View File

@ -5,13 +5,7 @@ function updateSellIn (state: any): number {
return calculatedSellIn;
}
calculatedSellIn = calculatedSellIn - 1;
if(calculatedSellIn < 0) {
return 0;
}
return calculatedSellIn;
return calculatedSellIn - 1;
}
export default updateSellIn;