fix: handle empty loyalty point details

(cherry picked from commit 1231ca17c9)
This commit is contained in:
diptanilsaha
2025-08-16 23:48:10 +05:30
committed by Mergify
parent 0a2a7fa6aa
commit dc953f70d1

View File

@@ -70,10 +70,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()