fix: resolve IndentationError in get_leaves_for_period - #5035
Conversation
Confidence Score: 4/5The PR appears safe to merge, but the new per-entry database lookup should be replaced with a bulk fetch or query join. The functional change has no established correctness failure, while its unconditional lookup creates a concrete non-blocking N+1 performance regression. Files Needing Attention: hrms/hr/doctype/leave_application/leave_application.py Reviews (1): Last reviewed commit: "fix: resolve IndentationError in get_lea..." | Re-trigger Greptile |
| leave_application = frappe.db.get_value( | ||
| "Leave Application", | ||
| leave_entry.transaction_name, | ||
| ["leave_type", "half_day", "half_day_date"], | ||
| as_dict=True, | ||
| ) |
There was a problem hiding this comment.
Avoid per-entry database queries
get_leaves_for_period now performs frappe.db.get_value for every matching ledger entry, making leave-balance reports, encashment, and balance checks progressively slower as ledger history grows; fetch these fields in bulk or join them into the existing query.
Context Used: Guidelines for reviewing Frappe Framework applicat... (source)
Summary
This PR fixes an
IndentationErrorin theget_leaves_for_periodfunction.Changes
Testing
IndentationError.Related Issue
Closes #5034