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 22d7bbb081
commit 0d6be69ce5

View File

@@ -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()