From d069e1603c2becc463bcbd5b1b396e9d82d0458c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 28 Apr 2016 15:15:40 +0530 Subject: [PATCH] [fix] do not count comments on for listview --- frappe/model/db_query.py | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/frappe/model/db_query.py b/frappe/model/db_query.py index 4006e7ca6a..bc28222c17 100644 --- a/frappe/model/db_query.py +++ b/frappe/model/db_query.py @@ -458,24 +458,6 @@ class DatabaseQuery(object): if not r.name: continue + r._comment_count = 0 if "_comments" in r: - comment_count = len(json.loads(r._comments or "[]")) - else: - comment_count = cint(frappe.db.get_value("Communication", - filters={ - "communication_type": "Comment", - "reference_doctype": self.doctype, - "reference_name": r.name, - "comment_type": "Comment" - }, - fieldname="count(name)")) - - communication_count = cint(frappe.db.get_value("Communication", - filters={ - "communication_type": "Communication", - "reference_doctype": self.doctype, - "reference_name": r.name - }, - fieldname="count(name)")) - - r._comment_count = comment_count + communication_count + r._comment_count = len(json.loads(r._comments or "[]"))