mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 03:03:50 +00:00
fix: handle empty loyalty point details
(cherry picked from commit 1231ca17c9)
This commit is contained in:
@@ -43,10 +43,10 @@ def get_loyalty_details(
|
||||
|
||||
loyalty_point_details = query.run(as_dict=True)
|
||||
|
||||
return {
|
||||
"loyalty_points": flt(loyalty_point_details[0].loyalty_points),
|
||||
"total_spent": flt(loyalty_point_details[0].total_spent),
|
||||
}
|
||||
if loyalty_point_details:
|
||||
return loyalty_point_details[0]
|
||||
else:
|
||||
return {"loyalty_points": 0, "total_spent": 0}
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
|
||||
Reference in New Issue
Block a user