Skip to content

Commit 0197603

Browse files
committed
order is now a dict too
1 parent 2554a1a commit 0197603

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

domain_model.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from dataclasses import dataclass
2-
31
class Allocation(dict):
42

53
@property
@@ -10,7 +8,7 @@ def skus(self):
108
def for_(order, source):
119
return Allocation({
1210
sku: source
13-
for sku, quantity in order.lines.items()
11+
for sku, quantity in order.items()
1412
if source.can_allocate(sku, quantity)
1513
})
1614

@@ -27,14 +25,11 @@ def fully_allocates(self, order):
2725

2826

2927

30-
@dataclass
31-
class Order:
32-
lines: dict
33-
allocation: Allocation = None
28+
class Order(dict):
3429

3530
@property
3631
def skus(self):
37-
return self.lines.keys()
32+
return self.keys()
3833

3934
@property
4035
def fully_allocated(self):

0 commit comments

Comments
 (0)