NOJIRA final touches
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user