Skip to content

Commit c7760d8

Browse files
committed
increase duplication
1 parent 623c9d0 commit c7760d8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎domain_model.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def __lt__(self, other):
6969
@dataclass
7070
class AllocationLine:
7171
sku: str
72+
quantity: int
7273
source: Stock
7374

7475

@@ -89,7 +90,7 @@ def sources(self):
8990
def for_(order: Order, source: Stock):
9091
return Allocation(
9192
lines=[
92-
AllocationLine(sku=line.sku, source=source) for line in order.lines
93+
AllocationLine(sku=line.sku, quantity=line.quantity, source=source) for line in order.lines
9394
if source.can_allocate(line)
9495
],
9596
order=order
@@ -106,5 +107,5 @@ def is_complete(self):
106107

107108
def apply(self):
108109
for line in self.lines:
109-
line.source.allocate(line.sku, self.order.quantities[line.sku])
110+
line.source.allocate(line.sku, line.quantity)
110111

0 commit comments

Comments
 (0)