From 796b11d665a49c69b9d2115a2ee4fca455269f08 Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Tue, 31 Oct 2023 15:36:01 +0530 Subject: [PATCH] chore(help_article): drop usage of ifnull Signed-off-by: Akhil Narang --- frappe/website/doctype/help_article/help_article.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/frappe/website/doctype/help_article/help_article.py b/frappe/website/doctype/help_article/help_article.py index 3f525b23b4..debf35f7d9 100644 --- a/frappe/website/doctype/help_article/help_article.py +++ b/frappe/website/doctype/help_article/help_article.py @@ -44,11 +44,7 @@ class HelpArticle(WebsiteGenerator): clear_cache() def update_category(self): - cnt = frappe.db.sql( - """select count(*) from `tabHelp Article` - where category=%s and ifnull(published,0)=1""", - self.category, - )[0][0] + cnt = frappe.db.count("Help Article", filters={"category": self.category, "published": 1}) cat = frappe.get_doc("Help Category", self.category) cat.help_articles = cnt cat.save() @@ -107,7 +103,7 @@ def get_sidebar_items(): from `tabHelp Category` where - ifnull(published,0)=1 and help_articles > 0 + published = 1 and help_articles > 0 order by help_articles desc""", as_dict=True,