From 094d543da2cad8ebc4f0b565b5d3c95db42188f8 Mon Sep 17 00:00:00 2001 From: Roman Kysil Date: Mon, 9 Dec 2024 11:40:55 +0100 Subject: [PATCH] Fix sorting bugs in @scadenziario-day --- CHANGES.rst | 3 ++- .../plone/contenttypes/restapi/services/scadenziario/post.py | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 9803a286..ed1424e0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 6.3.1 (unreleased) ------------------ -- Nothing changed yet. +- Fix sorting in @scadenziario-day endpoint. + [folix-01] 6.3.0 (2024-12-05) diff --git a/src/design/plone/contenttypes/restapi/services/scadenziario/post.py b/src/design/plone/contenttypes/restapi/services/scadenziario/post.py index 06670a08..e90d13e2 100644 --- a/src/design/plone/contenttypes/restapi/services/scadenziario/post.py +++ b/src/design/plone/contenttypes/restapi/services/scadenziario/post.py @@ -194,8 +194,8 @@ def reply(self): if query is None: raise Exception("No query supplied") - if sort_order: - sort_order = "descending" if sort_order else "ascending" + if sort_order not in {"descending", "ascending"}: + sort_order = "ascending" # results = querybuilder(**querybuilder_parameters) # Seems that origina querybuilder is not able to handle event search on @@ -286,7 +286,6 @@ def reply(self): } ) - results_to_be_returned[key].sort(key=lambda x: x["title"]) return { "@id": self.request.get("URL"), "items": results_to_be_returned,