Revert "[optimize] remove count(*) from queries"

This commit is contained in:
Rushabh Mehta
2016-11-21 21:04:47 +05:30
committed by GitHub
parent d3344ebcd1
commit 9872d8cdb5
6 changed files with 11 additions and 11 deletions

View File

@@ -177,7 +177,7 @@ class EmailDigest(Document):
if not user_id:
user_id = frappe.session.user
return frappe.db.sql("""select count(name) from `tabToDo`
return frappe.db.sql("""select count(*) from `tabToDo`
where status='Open' and (owner=%s or assigned_by=%s)""",
(user_id, user_id))[0][0]
@@ -202,7 +202,7 @@ class EmailDigest(Document):
def get_issue_count(self):
"""Get count of Issue"""
return frappe.db.sql("""select count(name) from `tabIssue`
return frappe.db.sql("""select count(*) from `tabIssue`
where status in ('Open','Replied') """)[0][0]
def get_project_list(self, user_id=None):
@@ -221,7 +221,7 @@ class EmailDigest(Document):
def get_project_count(self):
"""Get count of Project"""
return frappe.db.sql("""select count(name) from `tabProject`
return frappe.db.sql("""select count(*) from `tabProject`
where status='Open' and project_type='External'""")[0][0]
def set_accounting_cards(self, context):

View File

@@ -127,7 +127,7 @@ def get_item_for_list_in_html(context):
def get_group_item_count(item_group):
child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(item_group)])
return frappe.db.sql("""select count(name) from `tabItem`
return frappe.db.sql("""select count(*) from `tabItem`
where docstatus = 0 and show_in_website = 1
and (item_group in (%s)
or name in (select parent from `tabWebsite Item Group`