forked from github/plane
chore: toggle sub issue view and sub issue count in sub issues (#1312)
This commit is contained in:
parent
8496422d20
commit
ac6fae44e8
@ -259,7 +259,9 @@ class UserWorkSpaceIssues(BaseAPIView):
|
|||||||
def get(self, request, slug):
|
def get(self, request, slug):
|
||||||
try:
|
try:
|
||||||
issues = (
|
issues = (
|
||||||
Issue.issue_objects.filter(assignees__in=[request.user], workspace__slug=slug)
|
Issue.issue_objects.filter(
|
||||||
|
assignees__in=[request.user], workspace__slug=slug
|
||||||
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
|
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
|
||||||
.order_by()
|
.order_by()
|
||||||
@ -582,6 +584,12 @@ class SubIssuesEndpoint(BaseAPIView):
|
|||||||
.select_related("parent")
|
.select_related("parent")
|
||||||
.prefetch_related("assignees")
|
.prefetch_related("assignees")
|
||||||
.prefetch_related("labels")
|
.prefetch_related("labels")
|
||||||
|
.annotate(
|
||||||
|
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
|
||||||
|
.order_by()
|
||||||
|
.annotate(count=Func(F("id"), function="Count"))
|
||||||
|
.values("count")
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
state_distribution = (
|
state_distribution = (
|
||||||
|
@ -242,6 +242,18 @@ def filter_inbox_status(params, filter, method):
|
|||||||
return filter
|
return filter
|
||||||
|
|
||||||
|
|
||||||
|
def filter_sub_issue_toggle(params, filter, method):
|
||||||
|
if method == "GET":
|
||||||
|
sub_issue = params.get("sub_issue", "false")
|
||||||
|
if sub_issue == "false":
|
||||||
|
filter["parent__isnull"] = True
|
||||||
|
else:
|
||||||
|
sub_issue = params.get("sub_issue", "false")
|
||||||
|
if sub_issue == "false":
|
||||||
|
filter["parent__isnull"] = True
|
||||||
|
return filter
|
||||||
|
|
||||||
|
|
||||||
def issue_filters(query_params, method):
|
def issue_filters(query_params, method):
|
||||||
filter = dict()
|
filter = dict()
|
||||||
|
|
||||||
@ -263,7 +275,8 @@ def issue_filters(query_params, method):
|
|||||||
"project": filter_project,
|
"project": filter_project,
|
||||||
"cycle": filter_cycle,
|
"cycle": filter_cycle,
|
||||||
"module": filter_module,
|
"module": filter_module,
|
||||||
"inbox_status": filter_inbox_status
|
"inbox_status": filter_inbox_status,
|
||||||
|
"sub_issue": filter_sub_issue_toggle,
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, value in ISSUE_FILTER.items():
|
for key, value in ISSUE_FILTER.items():
|
||||||
|
Loading…
Reference in New Issue
Block a user