Skip to content

Commit

Permalink
refactor: remove relevant functions and files of listManager
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikSardana committed Dec 23, 2024
1 parent f6d14cd commit 4153940
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 389 deletions.
96 changes: 0 additions & 96 deletions desk/src/composables/listManager.ts

This file was deleted.

182 changes: 0 additions & 182 deletions helpdesk/extends/client.py

This file was deleted.

40 changes: 0 additions & 40 deletions helpdesk/extends/doc.py

This file was deleted.

25 changes: 9 additions & 16 deletions helpdesk/helpdesk/doctype/hd_article_category/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@


@frappe.whitelist()
def get_list_public():
fields = ["name", "category_name", "icon"]
categories = frappe.get_list(
"HD Article Category", fields=fields, filters={"parent_category": ""}
def get_subcategories(parent_category):
sub_categories = frappe.get_all(
"HD Article Category",
filters={"parent_category": parent_category},
fields=["name", "category_name", "icon", "description"],
)
res = []

for category in categories:
sub_categories = frappe.get_list(
"HD Article Category",
filters={"parent_category": category.name},
fields=fields,
for sub_category in sub_categories:
sub_category["article_count"] = frappe.db.count(
"HD Article", {"category": sub_category["name"]}
)
category.sub_categories = sub_categories
if len(sub_categories):
res.append(category)

return res
return sub_categories
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,9 @@
# from frappe import _
from frappe.model.document import Document
from frappe.utils import cint
from pypika.functions import Count
from pypika.queries import Query


class HDArticleCategory(Document):
@staticmethod
def get_list_select(query: Query):
QBCategory = frappe.qb.DocType("HD Article Category")
QBArticle = frappe.qb.DocType("HD Article")
count_article = (
frappe.qb.from_(QBArticle)
.select(Count("*"))
.as_("count_article")
.where(QBArticle.category == QBCategory.name)
)
query = query.select(QBCategory.star).select(count_article)
return query

def before_save(self):
if self.idx == -1 and self.status == "Published":
# index is only set if its not set already, this allows defining
Expand Down
Loading

0 comments on commit 4153940

Please sign in to comment.