NOJIRA restructed into separate model files

This commit is contained in:
2021-09-15 15:47:30 +02:00
parent 7f62cf38ae
commit 5aed069992
6 changed files with 89 additions and 63 deletions

13
models/item.py Normal file
View File

@@ -0,0 +1,13 @@
class Item:
def __init__(self, name: str, amount: int):
assert name == name.lower()
self.name = name
self.amount = amount
self.__contains_fries = 'friet' in self.name or 'twister' in self.name
def __lt__(self: "Item", other: "Item") -> bool:
if self.__contains_fries and not other.__contains_fries:
return True
if not self.__contains_fries and other.__contains_fries:
return False
return self.name < other.name