Skip to content

Commit

Permalink
🔄 update discount eligibility logic and response messages in lambda_h…
Browse files Browse the repository at this point in the history
…andler
  • Loading branch information
LokoMoloko98 committed Feb 2, 2025
1 parent af13350 commit a36d5d7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions swift-lift-fare-calculation/swift-lift-fare-calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,14 @@ def lambda_handler(event, context):
result = calculate_fare(total_trips=total_trips, missed_trips=missed_trips, weekly_fare=350) # Default weekly fare is 350 for now, will fetch from users DB later
final_fare = result['final_fare']
print(f"Final fare calculated: R{final_fare}")
discount_eligibility = False
discount_eligibility = ""
eligeble_missed_trips = result['eligible_missed_trips']
if eligeble_missed_trips > 0:
discount_eligibility = True
discount_eligibility = "Eligible for discount"
print(f"Eligible missed trips for discount: {eligeble_missed_trips}")
else:
discount_eligibility = "Not eligible for discount"
print("Not eligible for discount")

body = {}
body['passenger_id'] = passenger_id
Expand Down

0 comments on commit a36d5d7

Please sign in to comment.