2022-04-16 14:55:25 +02:00
|
|
|
from itertools import count
|
2022-05-22 16:27:36 +02:00
|
|
|
from typing import List
|
2022-04-16 14:55:25 +02:00
|
|
|
|
2022-05-09 15:49:11 +02:00
|
|
|
from data.ClientParams import ClientParams
|
2022-04-16 14:55:25 +02:00
|
|
|
from data.Item import Item
|
2022-05-09 15:49:11 +02:00
|
|
|
from data.enum.Priority import Priority
|
2022-03-24 20:43:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Order:
|
2022-04-16 14:55:25 +02:00
|
|
|
id_counter = count(start=0)
|
|
|
|
|
2022-05-22 16:27:36 +02:00
|
|
|
def __init__(self, time: int, items: [Item], priority: Priority, client_params: ClientParams):
|
2022-04-16 14:55:25 +02:00
|
|
|
self.id = next(self.id_counter)
|
|
|
|
self.time = time
|
2022-05-22 16:27:36 +02:00
|
|
|
self.items: List[Item] = items
|
|
|
|
self.client_params = client_params
|
2022-05-09 15:49:11 +02:00
|
|
|
self.priority = priority
|
2022-06-07 01:07:49 +02:00
|
|
|
self.sum = 0
|
|
|
|
|
|
|
|
# def sum_items(self, items: [Item]):
|
|
|
|
# result = 0
|
|
|
|
# for i in range(len(items)):
|
|
|
|
# result += items[i]
|
2022-05-22 16:27:36 +02:00
|
|
|
|
|
|
|
def __repr__(self) -> str:
|
|
|
|
return "items: {} priority: {}".format(self.items, self.priority)
|