fix: tiered loyalty program

This commit is contained in:
David
2024-05-21 07:50:25 +02:00
parent 618e737b0b
commit 81dc5872c4

View File

@@ -86,10 +86,9 @@ def get_loyalty_program_details_with_points(
tier_spent_level = sorted(
[d.as_dict() for d in loyalty_program.collection_rules],
key=lambda rule: rule.min_spent,
reverse=True,
)
for i, d in enumerate(tier_spent_level):
if i == 0 or (lp_details.total_spent + current_transaction_amount) <= d.min_spent:
if i == 0 or (lp_details.total_spent + current_transaction_amount) >= d.min_spent:
lp_details.tier_name = d.tier_name
lp_details.collection_factor = d.collection_factor
else: