chore(help_article): drop usage of ifnull
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
00e222f303
commit
796b11d665
1 changed files with 2 additions and 6 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue