fix: pagination grouping when grouping by created_by (#4783)
This commit is contained in:
parent
d64cc44225
commit
8071350640
2 changed files with 13 additions and 7 deletions
|
|
@ -188,4 +188,17 @@ def issue_group_values(field, slug, project_id=None, filters=dict):
|
||||||
return list(queryset.filter(project_id=project_id))
|
return list(queryset.filter(project_id=project_id))
|
||||||
else:
|
else:
|
||||||
return list(queryset)
|
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 []
|
return []
|
||||||
|
|
|
||||||
|
|
@ -393,16 +393,9 @@ class GroupedOffsetPaginator(OffsetPaginator):
|
||||||
# Grouping for single values
|
# Grouping for single values
|
||||||
processed_results = self.__get_field_dict()
|
processed_results = self.__get_field_dict()
|
||||||
for result in results:
|
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))
|
group_value = str(result.get(self.group_by_field_name))
|
||||||
if group_value in processed_results:
|
if group_value in processed_results:
|
||||||
processed_results[str(group_value)]["results"].append(result)
|
processed_results[str(group_value)]["results"].append(result)
|
||||||
|
|
||||||
return processed_results
|
return processed_results
|
||||||
|
|
||||||
def process_results(self, results):
|
def process_results(self, results):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue