1 parent eb49ab4 commit e2e7bc5Copy full SHA for e2e7bc5
1 file changed
model.py
@@ -29,6 +29,9 @@ def __init__(
29
self._purchased_quantity = qty
30
self._allocations = set() # type: Set[OrderLine]
31
32
+ def __repr__(self):
33
+ return f'<Batch {self.reference}>'
34
+
35
def __eq__(self, other):
36
if not isinstance(other, Batch):
37
return False
@@ -37,6 +40,13 @@ def __eq__(self, other):
40
def __hash__(self):
38
41
return hash(self.reference)
39
42
43
+ def __gt__(self, other):
44
+ if self.eta is None:
45
+ return False
46
+ if other.eta is None:
47
+ return True
48
+ return self.eta > other.eta
49
50
def allocate(self, line: OrderLine):
51
if self.can_allocate(line):
52
self._allocations.add(line)
0 commit comments