Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07dd382

Browse files
committed
make Batches sortable [dunder_gt]
1 parent0c3b87e commit07dd382

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎model.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def __init__(self, ref: str, sku: str, qty: int, eta: Optional[date]):
2525
self._purchased_quantity=qty
2626
self._allocations=set()# type: Set[OrderLine]
2727

28+
def__repr__(self):
29+
returnf"<Batch{self.reference}>"
30+
2831
def__eq__(self,other):
2932
ifnotisinstance(other,Batch):
3033
returnFalse
@@ -33,6 +36,13 @@ def __eq__(self, other):
3336
def__hash__(self):
3437
returnhash(self.reference)
3538

39+
def__gt__(self,other):
40+
ifself.etaisNone:
41+
returnFalse
42+
ifother.etaisNone:
43+
returnTrue
44+
returnself.eta>other.eta
45+
3646
defallocate(self,line:OrderLine):
3747
ifself.can_allocate(line):
3848
self._allocations.add(line)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp