Update app.py
Browse files
app.py
CHANGED
@@ -236,18 +236,14 @@ def order_summary():
|
|
236 |
item_parts = line.split('|')
|
237 |
if len(item_parts) >= 5:
|
238 |
item_name = item_parts[0].strip()
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
order_items.append({
|
244 |
-
"name":
|
245 |
-
"addons": item_addons,
|
246 |
-
"instructions": item_instructions,
|
247 |
-
"price": item_price,
|
248 |
-
"image_url": item_image_url
|
249 |
})
|
250 |
-
print(f"Extracted item: {
|
251 |
|
252 |
if not order_items:
|
253 |
print("No items found in order details.")
|
@@ -256,7 +252,7 @@ def order_summary():
|
|
256 |
|
257 |
# Pass these values to your template
|
258 |
return render_template(
|
259 |
-
'
|
260 |
order=order,
|
261 |
order_items=order_items
|
262 |
)
|
@@ -265,6 +261,11 @@ def order_summary():
|
|
265 |
print(f"Error querying Salesforce: {str(e)}")
|
266 |
return f"Error querying Salesforce: {str(e)}", 500
|
267 |
|
|
|
|
|
|
|
|
|
|
|
268 |
|
269 |
@app.route("/logout")
|
270 |
def logout():
|
|
|
236 |
item_parts = line.split('|')
|
237 |
if len(item_parts) >= 5:
|
238 |
item_name = item_parts[0].strip()
|
239 |
+
|
240 |
+
# Remove quantity and price from the item name (e.g., 'Chicken Biryani x1.0' becomes 'Chicken Biryani')
|
241 |
+
item_name_cleaned = ' '.join(item_name.split(' ')[:-1]).strip()
|
242 |
+
|
243 |
order_items.append({
|
244 |
+
"name": item_name_cleaned
|
|
|
|
|
|
|
|
|
245 |
})
|
246 |
+
print(f"Extracted item name: {item_name_cleaned}")
|
247 |
|
248 |
if not order_items:
|
249 |
print("No items found in order details.")
|
|
|
252 |
|
253 |
# Pass these values to your template
|
254 |
return render_template(
|
255 |
+
'order_summary.html',
|
256 |
order=order,
|
257 |
order_items=order_items
|
258 |
)
|
|
|
261 |
print(f"Error querying Salesforce: {str(e)}")
|
262 |
return f"Error querying Salesforce: {str(e)}", 500
|
263 |
|
264 |
+
|
265 |
+
except Exception as e:
|
266 |
+
print(f"Error querying Salesforce: {str(e)}")
|
267 |
+
return f"Error querying Salesforce: {str(e)}", 500
|
268 |
+
|
269 |
|
270 |
@app.route("/logout")
|
271 |
def logout():
|