fix: pagination grouping when grouping by created_by (#4783)

This commit is contained in:
Nikhil 2024-06-12 18:55:44 +05:30 committed by GitHub
parent d64cc44225
commit 8071350640
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 7 deletions

View File

@ -188,4 +188,17 @@ def issue_group_values(field, slug, project_id=None, filters=dict):
return list(queryset.filter(project_id=project_id))
else:
return list(queryset)
if field == "created_by":
queryset = (
Issue.issue_objects.filter(workspace__slug=slug)
.filter(**filters)
.values_list("created_by", flat=True)
.distinct()
)
if project_id:
return list(queryset.filter(project_id=project_id))
else:
return list(queryset)
return []

View File

@ -393,16 +393,9 @@ class GroupedOffsetPaginator(OffsetPaginator):
# Grouping for single values
processed_results = self.__get_field_dict()
for result in results:
(
print(result["created_at"].date(), result["priority"])
if str(result[self.group_by_field_name])
== "c88dfd3b-e97e-4948-851b-a5fe1e36ffd0"
else None
)
group_value = str(result.get(self.group_by_field_name))
if group_value in processed_results:
processed_results[str(group_value)]["results"].append(result)
return processed_results
def process_results(self, results):