Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: sort #1107

Merged
merged 5 commits into from
Apr 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: sort: remove cache
  • Loading branch information
ssiyad committed Apr 11, 2023
commit 0614ea7b25560de999c86ba80d69bbc492a2cfc4
6 changes: 2 additions & 4 deletions helpdesk/extends/doc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from functools import lru_cache
from types import FunctionType

import frappe
from frappe.model.document import get_controller
from frappe.query_builder import Order
from frappe.query_builder import Order, Query

SORT_OPTIONS_METHOD = "sort_options"
DEFAULT_SORT_FIELD = "modified"
Expand All @@ -20,8 +19,7 @@ def sort_options(doctype: str):
return c.sort_options().keys()


@lru_cache
def apply_sort(doctype: str, order_by: str, query):
def apply_sort(doctype: str, order_by: str, query: Query):
controller = get_controller(doctype)
fallback = query.orderby(DEFAULT_SORT_FIELD, order=DEFAULT_SORT_DIRECTION)

Expand Down