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:
@@ -813,7 +813,7 @@
|
|||||||
"idx": 24,
|
"idx": 24,
|
||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-06-17 11:31:37.730760",
|
"modified": "2022-07-18 20:03:43.188705",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Employee",
|
"name": "Employee",
|
||||||
|
|||||||
@@ -115,6 +115,6 @@ def is_holiday(holiday_list, date=None):
|
|||||||
if date is None:
|
if date is None:
|
||||||
date = today()
|
date = today()
|
||||||
if holiday_list:
|
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:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user