From fee8f153a360d7f1c70f11bba79225af103c947f Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Mon, 24 Jul 2023 12:14:47 +0530 Subject: [PATCH] chore: return total members, cycle and modules --- apiserver/plane/api/views/project.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apiserver/plane/api/views/project.py b/apiserver/plane/api/views/project.py index 5c6ea3fd157..4e5265d6a49 100644 --- a/apiserver/plane/api/views/project.py +++ b/apiserver/plane/api/views/project.py @@ -91,6 +91,24 @@ def get_queryset(self): ) ) ) + .annotate( + total_members=ProjectMember.objects.filter(project_id=OuterRef("id")) + .order_by() + .annotate(count=Func(F("id"), function="Count")) + .values("count") + ) + .annotate( + total_cycles=Cycle.objects.filter(project_id=OuterRef("id")) + .order_by() + .annotate(count=Func(F("id"), function="Count")) + .values("count") + ) + .annotate( + total_modules=Module.objects.filter(project_id=OuterRef("id")) + .order_by() + .annotate(count=Func(F("id"), function="Count")) + .values("count") + ) .distinct() )