nagasurendra commited on
Commit
62801cd
·
verified ·
1 Parent(s): 917882b

Update order.py

Browse files
Files changed (1) hide show
  1. order.py +5 -4
order.py CHANGED
@@ -20,12 +20,13 @@ def order_summary():
20
  ORDER BY CreatedDate DESC
21
  LIMIT 1
22
  """)
23
- order = result.get("records", [])[0] if result.get("records") else None
24
-
25
- if not order:
26
  return render_template("order.html", order=None)
27
 
 
28
  return render_template("order.html", order=order)
29
  except Exception as e:
30
  print(f"Error fetching order details: {str(e)}")
31
- return render_template("order.html", order=None, error=str(e))
 
20
  ORDER BY CreatedDate DESC
21
  LIMIT 1
22
  """)
23
+ order_records = result.get("records", [])
24
+
25
+ if not order_records:
26
  return render_template("order.html", order=None)
27
 
28
+ order = order_records[0] # Safely access the first record
29
  return render_template("order.html", order=order)
30
  except Exception as e:
31
  print(f"Error fetching order details: {str(e)}")
32
+ return render_template("order.html", order=None, error=str(e))