From 4341bce9a813e3c749ab5ef88e59fb91336c3b95 Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Tue, 26 Mar 2024 13:54:38 +0530 Subject: [PATCH] dev: add sorting --- apiserver/plane/utils/paginator.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apiserver/plane/utils/paginator.py b/apiserver/plane/utils/paginator.py index 34bd12d21..7ff172af3 100644 --- a/apiserver/plane/utils/paginator.py +++ b/apiserver/plane/utils/paginator.py @@ -340,6 +340,11 @@ class GroupedOffsetPaginator(OffsetPaginator): group_value = str(result.get(self.group_by_field_name)) if group_value in processed_results: processed_results[str(group_value)]["results"].append(result) + + for group_value, data in processed_results.items(): + data["results"].sort( + key=lambda x: x.get("created_at"), reverse=True + ) return processed_results def process_results(self, results):