Skip to content

Commit

Permalink
perf: limit rows to 1 for cf leave expiry query
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchamahabal committed Nov 17, 2023
1 parent 1bd3f4e commit 635c3d5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion erpnext/hr/doctype/leave_application/leave_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 += (
Expand Down

0 comments on commit 635c3d5

Please sign in to comment.