Skip to content

Commit

Permalink
Mon Nov 04 07:05:08 UTC 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
sbx_user1051 committed Nov 4, 2024
1 parent 911c35b commit 8681fce
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/solutions/CHK/checkout_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,16 @@ def checkout(skus):
groupDealCombo = groupDeal['combo']
diff = deepcopy(groupDealCombo)
diff.subtract(basket)

print(f'Diff is {diff.total()}')
groupDealComboExists = diff.total() <= groupDealCombo.total() - groupDeal['amount']

while groupDealComboExists:
basket.subtract(groupDealCombo)
total += groupDeal['amount']
diff = deepcopy(groupDealCombo)
diff.subtract(basket)
print(f'Diff is {diff.total()}')
groupDealComboExists = diff.total() <= groupDealCombo.total() - groupDeal['amount']


bogofExists = bogofDict.get(item, None) != None
Expand Down Expand Up @@ -241,3 +249,4 @@ def checkout(skus):




0 comments on commit 8681fce

Please sign in to comment.