perf: Replace db.get_all with db.exists in is_holiday

- widely used function call, fetching all rows for holidays
This commit is contained in:
Rucha Mahabal
2022-07-18 21:08:15 +05:30
parent 144057f7e3
commit 85c554eab5
2 changed files with 2 additions and 2 deletions

View File

@@ -813,7 +813,7 @@
"idx": 24,
"image_field": "image",
"links": [],
"modified": "2021-06-17 11:31:37.730760",
"modified": "2022-07-18 20:03:43.188705",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee",

View File

@@ -115,6 +115,6 @@ def is_holiday(holiday_list, date=None):
if date is None:
date = today()
if holiday_list:
return bool(frappe.get_all("Holiday List", dict(name=holiday_list, holiday_date=date)))
return bool(frappe.db.exists("Holiday List", {"name": holiday_list, "holiday_date": date}))
else:
return False