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, } )