From b18987bcef3f64ad8bb6b019615a77a6dac2d9eb Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Fri, 22 Mar 2024 17:27:49 +0530 Subject: [PATCH 1/2] fix: label id and assignee id interchange --- apiserver/plane/utils/grouper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apiserver/plane/utils/grouper.py b/apiserver/plane/utils/grouper.py index 5489683ae..b6bc1a347 100644 --- a/apiserver/plane/utils/grouper.py +++ b/apiserver/plane/utils/grouper.py @@ -26,8 +26,8 @@ def issue_queryset_grouper(queryset, group_by, sub_group_by): } annotations_map = { - "label_ids": ("assignees__id", ~Q(assignees__id__isnull=True)), - "assignee_ids": ("labels__id", ~Q(labels__id__isnull=True)), + "assignee_ids": ("assignees__id", ~Q(assignees__id__isnull=True)), + "label_ids": ("labels__id", ~Q(labels__id__isnull=True)), "module_ids": ( "issue_module__module_id", ~Q(issue_module__module_id__isnull=True), From aea30897d54173a2ae95acda2b5fa47133dc4008 Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Fri, 22 Mar 2024 17:42:57 +0530 Subject: [PATCH 2/2] dev: fix priority ordering --- apiserver/plane/app/views/cycle/base.py | 12 +++++++++-- apiserver/plane/app/views/issue/archive.py | 12 +++++++++-- apiserver/plane/app/views/issue/base.py | 24 ++++++++++++++++++---- apiserver/plane/app/views/issue/draft.py | 12 +++++++++-- apiserver/plane/app/views/module/base.py | 12 +++++++++-- apiserver/plane/app/views/view/base.py | 12 +++++++++-- apiserver/plane/space/views/issue.py | 12 +++++++++-- 7 files changed, 80 insertions(+), 16 deletions(-) diff --git a/apiserver/plane/app/views/cycle/base.py b/apiserver/plane/app/views/cycle/base.py index ccc8087be..d36c36dd5 100644 --- a/apiserver/plane/app/views/cycle/base.py +++ b/apiserver/plane/app/views/cycle/base.py @@ -819,7 +819,11 @@ class CycleIssueViewSet(WebhookMixin, BaseViewSet): # group and sub group pagination return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, @@ -855,7 +859,11 @@ class CycleIssueViewSet(WebhookMixin, BaseViewSet): # Group paginate return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, diff --git a/apiserver/plane/app/views/issue/archive.py b/apiserver/plane/app/views/issue/archive.py index fe8265723..f9c59b928 100644 --- a/apiserver/plane/app/views/issue/archive.py +++ b/apiserver/plane/app/views/issue/archive.py @@ -142,7 +142,11 @@ class IssueArchiveViewSet(BaseViewSet): # group and sub group pagination return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, @@ -178,7 +182,11 @@ class IssueArchiveViewSet(BaseViewSet): # Group paginate return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, diff --git a/apiserver/plane/app/views/issue/base.py b/apiserver/plane/app/views/issue/base.py index 8d1bad4f5..59feccd4d 100644 --- a/apiserver/plane/app/views/issue/base.py +++ b/apiserver/plane/app/views/issue/base.py @@ -142,7 +142,11 @@ class IssueListEndpoint(BaseAPIView): # group and sub group pagination return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, @@ -178,7 +182,11 @@ class IssueListEndpoint(BaseAPIView): # Group paginate return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, @@ -308,7 +316,11 @@ class IssueViewSet(WebhookMixin, BaseViewSet): else: return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, @@ -343,7 +355,11 @@ class IssueViewSet(WebhookMixin, BaseViewSet): # Group paginate return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, diff --git a/apiserver/plane/app/views/issue/draft.py b/apiserver/plane/app/views/issue/draft.py index 181920e5d..24b8b08e0 100644 --- a/apiserver/plane/app/views/issue/draft.py +++ b/apiserver/plane/app/views/issue/draft.py @@ -129,7 +129,11 @@ class IssueDraftViewSet(BaseViewSet): # group and sub group pagination return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, @@ -165,7 +169,11 @@ class IssueDraftViewSet(BaseViewSet): # Group paginate return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, diff --git a/apiserver/plane/app/views/module/base.py b/apiserver/plane/app/views/module/base.py index 48bdea1dd..0c47c928e 100644 --- a/apiserver/plane/app/views/module/base.py +++ b/apiserver/plane/app/views/module/base.py @@ -543,7 +543,11 @@ class ModuleIssueViewSet(WebhookMixin, BaseViewSet): # group and sub group pagination return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, @@ -579,7 +583,11 @@ class ModuleIssueViewSet(WebhookMixin, BaseViewSet): # Group paginate return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, diff --git a/apiserver/plane/app/views/view/base.py b/apiserver/plane/app/views/view/base.py index 65b474170..d813414e4 100644 --- a/apiserver/plane/app/views/view/base.py +++ b/apiserver/plane/app/views/view/base.py @@ -188,7 +188,11 @@ class GlobalViewIssuesViewSet(BaseViewSet): # group and sub group pagination return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, @@ -224,7 +228,11 @@ class GlobalViewIssuesViewSet(BaseViewSet): # Group paginate return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, diff --git a/apiserver/plane/space/views/issue.py b/apiserver/plane/space/views/issue.py index d410c0318..92653f721 100644 --- a/apiserver/plane/space/views/issue.py +++ b/apiserver/plane/space/views/issue.py @@ -592,7 +592,11 @@ class ProjectIssuesPublicEndpoint(BaseAPIView): # group and sub group pagination return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by, @@ -628,7 +632,11 @@ class ProjectIssuesPublicEndpoint(BaseAPIView): # Group paginate return self.paginate( request=request, - order_by=order_by_param, + order_by=( + "priority_order" + if order_by_param in ["priority", "-priority"] + else order_by_param + ), queryset=issue_queryset, on_results=lambda issues: issue_on_results( group_by=group_by,