Rammohan0504 commited on
Commit
afa308c
·
verified ·
1 Parent(s): 8e33160

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -561,15 +561,13 @@ def order_summary():
561
 
562
  # Fetch the applied coupon codes for the user
563
  coupon_result = sf.query(f"""
564
- SELECT Coupon_Code__c, Discount__c
565
  FROM Referral_Coupon__c
566
  WHERE Customer_Email__c = '{email}' AND Coupon_Status__c = 'Active'
567
  """)
568
 
569
- discount = 0.0
570
- if coupon_result['records']:
571
- coupon = coupon_result['records'][0]
572
- discount = coupon.get('Discount__c', 0.0) # Assuming Discount__c is a custom field for discount
573
 
574
  # Calculate the final total after applying discount
575
  final_total = order['Total_Amount__c'] - discount # Final price after discount
 
561
 
562
  # Fetch the applied coupon codes for the user
563
  coupon_result = sf.query(f"""
564
+ SELECT Coupon_Code__c
565
  FROM Referral_Coupon__c
566
  WHERE Customer_Email__c = '{email}' AND Coupon_Status__c = 'Active'
567
  """)
568
 
569
+ discount_percentage = 10 # Apply 10% discount
570
+ discount = order['Total_Amount__c'] * (discount_percentage / 100) # Calculate the discount value
 
 
571
 
572
  # Calculate the final total after applying discount
573
  final_total = order['Total_Amount__c'] - discount # Final price after discount