Merge pull request #561 from kakde-sandeep/fix-count-performance

This commit is contained in:
Shariq Ansari 2025-02-26 18:06:32 +05:30 committed by GitHub
commit 5b757918a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -379,9 +379,11 @@ def get_data(
new_filters = filters.copy()
new_filters.update({column_field: kc.get("name")})
all_count = len(
frappe.get_list(doctype, filters=convert_filter_to_tuple(doctype, new_filters))
)
all_count = frappe.get_list(
doctype,
filters=convert_filter_to_tuple(doctype, new_filters),
fields="count(*) as total_count"
)[0].total_count
kc["all_count"] = all_count
kc["count"] = len(column_data)
@ -483,7 +485,9 @@ def get_data(
"page_length_count": page_length_count,
"is_default": is_default,
"views": get_views(doctype),
"total_count": len(frappe.get_list(doctype, filters=filters)),
"total_count": frappe.get_list(
doctype, filters=filters, fields="count(*) as total_count"
)[0].total_count,
"row_count": len(data),
"form_script": get_form_script(doctype),
"list_script": get_form_script(doctype, "List"),