mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: sub issue endpoint for state distribution (#1845)
This commit is contained in:
parent
abec46a725
commit
6617049983
@ -758,18 +758,16 @@ class SubIssuesEndpoint(BaseAPIView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
state_distribution = (
|
state_distribution = (
|
||||||
State.objects.filter(~Q(name="Triage"), workspace__slug=slug)
|
State.objects.filter(
|
||||||
.annotate(
|
workspace__slug=slug, state_issue__parent_id=issue_id
|
||||||
state_count=Count(
|
|
||||||
"state_issue",
|
|
||||||
filter=Q(state_issue__parent_id=issue_id),
|
|
||||||
)
|
)
|
||||||
)
|
.annotate(state_group=F("group"))
|
||||||
.order_by("group")
|
.values("state_group")
|
||||||
.values("group", "state_count")
|
.annotate(state_count=Count("state_group"))
|
||||||
|
.order_by("state_group")
|
||||||
)
|
)
|
||||||
|
|
||||||
result = {item["group"]: item["state_count"] for item in state_distribution}
|
result = {item["state_group"]: item["state_count"] for item in state_distribution}
|
||||||
|
|
||||||
serializer = IssueLiteSerializer(
|
serializer = IssueLiteSerializer(
|
||||||
sub_issues,
|
sub_issues,
|
||||||
|
Loading…
Reference in New Issue
Block a user