NOJIRA final touches

This commit is contained in:
2021-09-15 17:14:34 +02:00
parent 5a9a6658ab
commit 8c6078d625
5 changed files with 24 additions and 13 deletions

View File

@@ -10,7 +10,10 @@ class DTO:
self.__items: Dict[str, int] = {}
self.__orders: List[Order] = []
def add(self, applicant_name: str, item_names: List[str]):
def add(self,
applicant_name: str,
item_names: List[str]
) -> None:
self.__applicants.append(applicant_name)
for item_name in item_names:

View File

@@ -1,11 +1,15 @@
class Item:
def __init__(self, name: str, amount: int):
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:
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:

View File

@@ -2,9 +2,13 @@ from typing import List
class Order:
def __init__(self, name: str, items: List[str]):
def __init__(self,
name: str,
items: List[str]):
self.name = name
self.items = items
def __lt__(self: "Order", other: "Order") -> bool:
def __lt__(self: "Order",
other: "Order"
) -> bool:
return self.name < other.name