From b6ab853c57c51d24a14d10b911ebe9df12013376 Mon Sep 17 00:00:00 2001 From: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:48:14 +0530 Subject: [PATCH] chore: filter out the removed cycle from issue detail (#6138) --- apiserver/plane/app/views/issue/base.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apiserver/plane/app/views/issue/base.py b/apiserver/plane/app/views/issue/base.py index 3d548aeac..7c15f91da 100644 --- a/apiserver/plane/app/views/issue/base.py +++ b/apiserver/plane/app/views/issue/base.py @@ -445,12 +445,10 @@ class IssueViewSet(BaseViewSet): .select_related("workspace", "project", "state", "parent") .prefetch_related("assignees", "labels", "issue_module__module") .annotate( - cycle_id=Case( - When( - issue_cycle__cycle__deleted_at__isnull=True, - then=F("issue_cycle__cycle_id"), - ), - default=None, + cycle_id=Subquery( + CycleIssue.objects.filter(issue=OuterRef("id")).values("cycle_id")[ + :1 + ] ) ) .annotate(