Skip to content

Commit

Permalink
chore: sub issues count in individual issue (#2221)
Browse files Browse the repository at this point in the history
  • Loading branch information
NarayanBavisetti authored Sep 20, 2023
1 parent cdfff12 commit 60ae940
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apiserver/plane/api/views/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,12 @@ def create(self, request, slug, project_id):

def retrieve(self, request, slug, project_id, pk=None):
try:
issue = Issue.issue_objects.get(
issue = Issue.issue_objects.annotate(
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
.order_by()
.annotate(count=Func(F("id"), function="Count"))
.values("count")
).get(
workspace__slug=slug, project_id=project_id, pk=pk
)
return Response(IssueSerializer(issue).data, status=status.HTTP_200_OK)
Expand Down

2 comments on commit 60ae940

@vercel
Copy link

@vercel vercel bot commented on 60ae940 Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./web/

plane-dev.vercel.app
plane-dev-plane.vercel.app
plane-dev-git-develop-plane.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 60ae940 Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-sh-dev – ./space/

plane-sh-dev-plane.vercel.app
plane-space-dev.vercel.app
plane-sh-dev-git-develop-plane.vercel.app

Please sign in to comment.