nagasurendra commited on
Commit
d316910
·
verified ·
1 Parent(s): b961201

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -62,8 +62,7 @@ def order_history():
62
  try:
63
  # Fetch order records for the logged-in user
64
  result = sf.query(f"""
65
- SELECT Id, Customer_Name__c, Customer_Email__c, Total_Amount__c,
66
- Order_Details__c, Order_Status__c, Discount__c, Total_Bill__c, CreatedDate
67
  FROM Order__c
68
  WHERE Customer_Email__c = '{email}'
69
  ORDER BY CreatedDate DESC
@@ -71,7 +70,11 @@ def order_history():
71
  """)
72
 
73
  orders = result.get("records", []) # Get the order records (max 5)
74
-
 
 
 
 
75
  return render_template("order_history.html", orders=orders) # Pass to template
76
 
77
  except Exception as e:
@@ -79,7 +82,6 @@ def order_history():
79
  return render_template("order_history.html", orders=[], error=str(e))
80
 
81
 
82
-
83
  @app.route("/signup", methods=["GET", "POST"])
84
  def signup():
85
  if request.method == "POST":
 
62
  try:
63
  # Fetch order records for the logged-in user
64
  result = sf.query(f"""
65
+ SELECT Id, Order_Details__c, Total_Amount__c, Discount__c, Total_Bill__c, CreatedDate
 
66
  FROM Order__c
67
  WHERE Customer_Email__c = '{email}'
68
  ORDER BY CreatedDate DESC
 
70
  """)
71
 
72
  orders = result.get("records", []) # Get the order records (max 5)
73
+
74
+ # Process the order details to split each line into individual items
75
+ for order in orders:
76
+ order['items'] = order['Order_Details__c'].split('\n') # Split the order details into lines/items
77
+
78
  return render_template("order_history.html", orders=orders) # Pass to template
79
 
80
  except Exception as e:
 
82
  return render_template("order_history.html", orders=[], error=str(e))
83
 
84
 
 
85
  @app.route("/signup", methods=["GET", "POST"])
86
  def signup():
87
  if request.method == "POST":