27 lines
764 B
Python
27 lines
764 B
Python
from itertools import count
|
|
from typing import List
|
|
|
|
from data.ClientParams import ClientParams
|
|
from data.Item import Item
|
|
from data.enum.Priority import Priority
|
|
|
|
|
|
class Order:
|
|
id_counter = count(start=0)
|
|
|
|
def __init__(self, time: int, items: [Item], priority: Priority, sum: int, client_params: ClientParams):
|
|
self.id = next(self.id_counter)
|
|
self.time = time
|
|
self.items: List[Item] = items
|
|
self.client_params = client_params
|
|
self.priority = priority
|
|
self.sum = sum
|
|
|
|
# def sum_items(self, items: [Item]):
|
|
# result = 0
|
|
# for i in range(len(items)):
|
|
# result += items[i]
|
|
|
|
def __repr__(self) -> str:
|
|
return "items: {} priority: {}".format(self.items, self.priority)
|