Skip to content

Commit 4dff252

Browse files
committed
set-skus thing
1 parent 9257c6f commit 4dff252

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎domain_model.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def __init__(self, eta, lines):
55

66

77
def skus(d):
8-
return d.keys()
8+
return set(d.keys())
99

1010

1111
def allocate_to(order, source):
@@ -18,15 +18,15 @@ def allocate_to(order, source):
1818

1919
def allocate(order, stock, shipments):
2020
stock_allocation = allocate_to(order, stock)
21-
if set(stock_allocation) == set(order):
21+
if skus(stock_allocation) == skus(order):
2222
return stock_allocation
2323

2424
shipments.sort(key=lambda s: s.eta)
2525

2626
shipment_allocations = []
2727
for shipment in shipments:
2828
shipment_allocation = allocate_to(order, shipment)
29-
if set(shipment_allocation) == set(order):
29+
if skus(shipment_allocation) == skus(order):
3030
return shipment_allocation
3131
shipment_allocations.append(shipment_allocation)
3232

0 commit comments

Comments
 (0)