Skip to content

Commit

Permalink
fix: attachment_count in issue pagination v2 endpoint (#5840)
Browse files Browse the repository at this point in the history
* fix: attachemnt_count in the issue pagination v2 endpoint

* fix: string comparision in description check in params
  • Loading branch information
gurusainath authored Oct 15, 2024
1 parent 4e70e89 commit 5f9af92
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions apiserver/plane/app/views/issue/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,15 @@ def get_queryset(self):
.annotate(count=Func(F("id"), function="Count"))
.values("count")
)
.annotate(
attachment_count=FileAsset.objects.filter(
issue_id=OuterRef("id"),
entity_type=FileAsset.EntityTypeContext.ISSUE_ATTACHMENT,
)
.order_by()
.annotate(count=Func(F("id"), function="Count"))
.values("count")
)
.annotate(
sub_issues_count=Issue.issue_objects.filter(
parent=OuterRef("id")
Expand All @@ -779,7 +788,7 @@ def process_paginated_result(self, fields, results, timezone):
@allow_permission([ROLE.ADMIN, ROLE.MEMBER, ROLE.GUEST])
def list(self, request, slug, project_id):
cursor = request.GET.get("cursor", None)
is_description_required = request.GET.get("description", False)
is_description_required = request.GET.get("description", "false")
updated_at = request.GET.get("updated_at__gt", None)

# required fields
Expand Down Expand Up @@ -812,7 +821,7 @@ def list(self, request, slug, project_id):
"sub_issues_count",
]

if is_description_required:
if str(is_description_required).lower() == "true":
required_fields.append("description_html")

# querying issues
Expand Down

0 comments on commit 5f9af92

Please sign in to comment.