From ab23816816f16b7f10411423f1e60547ff64606c Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 13 Dec 2022 23:21:32 -0500 Subject: [PATCH] in postgres you cannot order by a non-grouped column without doing an aggregate --- .../src/spiffworkflow_backend/routes/process_api_blueprint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index 026ed35d..ea7b675f 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -1025,11 +1025,11 @@ def process_instance_list( elif attribute in instance_metadata_aliases: if order_by_option.startswith("-"): order_by_query_array.append( - instance_metadata_aliases[attribute].value.desc() + func.max(instance_metadata_aliases[attribute].value).desc() ) else: order_by_query_array.append( - instance_metadata_aliases[attribute].value.asc() + func.max(instance_metadata_aliases[attribute].value).asc() ) process_instances = (