Created
August 6, 2023 19:04
-
-
Save ClausPolanka/14ddb1cfccd5135bc00037c24db4b967 to your computer and use it in GitHub Desktop.
StandardType
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StandardType : ItemType { | |
override fun update(item: Item, on: LocalDate): Item { | |
val degredation = when { | |
on.isAfter(item.sellByDate) -> 2 | |
else -> 1 | |
} | |
return item.withQuality(item.quality - degredation) | |
} | |
override fun toString() = "STANDARD" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment