Skip to content

Instantly share code, notes, and snippets.

@ClausPolanka
Created August 6, 2023 19:04
Show Gist options
  • Save ClausPolanka/14ddb1cfccd5135bc00037c24db4b967 to your computer and use it in GitHub Desktop.
Save ClausPolanka/14ddb1cfccd5135bc00037c24db4b967 to your computer and use it in GitHub Desktop.
StandardType
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