perf: limit rows to 1 for cf leave expiry query

This commit is contained in:
Rucha Mahabal
2023-11-17 15:22:49 +05:30
parent 1bd3f4eeef
commit 635c3d54f5

View File

@@ -717,6 +717,7 @@ def get_allocation_expiry_for_cf_leaves(
"docstatus": 1,
},
fields=["to_date"],
limit=1,
)
return expiry[0]["to_date"] if expiry else ""
@@ -1017,7 +1018,7 @@ def get_leaves_for_period(
if leave_entry.leaves % 1:
half_day = 1
half_day_date = frappe.db.get_value(
"Leave Application", {"name": leave_entry.transaction_name}, ["half_day_date"]
"Leave Application", {"name": leave_entry.transaction_name}, "half_day_date"
)
leave_days += (