From 90485fc8f72c78c71fd89eca36164ee3f40035c4 Mon Sep 17 00:00:00 2001 From: remyvdwereld <86827854+remyvdwereld@users.noreply.github.com> Date: Mon, 2 Oct 2023 09:57:58 +0200 Subject: [PATCH] Sort for permit type --- app/apps/permits/api_queries_decos_join.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/apps/permits/api_queries_decos_join.py b/app/apps/permits/api_queries_decos_join.py index 217bfad1b..6b00b02ba 100644 --- a/app/apps/permits/api_queries_decos_join.py +++ b/app/apps/permits/api_queries_decos_join.py @@ -411,9 +411,12 @@ def get_decos_entry_by_bag_id(self, bag_id, dt): # Extend the original permits list with new items permits.extend(new_permits) + # Sort the list based on the "permit_type" key + sorted_permits = sorted(permits, key=lambda x: x["permit_type"]) + response.update( { - "permits": permits, + "permits": sorted_permits, "decos_folders": response_decos_folder, } )