From a39cccabdb41440bfeff6fae6ec3500a53fcff63 Mon Sep 17 00:00:00 2001 From: jbirddog <100367399+jbirddog@users.noreply.github.com> Date: Fri, 9 Dec 2022 13:14:26 -0500 Subject: [PATCH] Sort primary file to top of files list (#71) --- .../spiffworkflow_backend/routes/process_api_blueprint.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 d8effe0d7..4fd714f24 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -346,7 +346,10 @@ def process_model_show(modified_process_model_identifier: str) -> Any: """Process_model_show.""" process_model_identifier = modified_process_model_identifier.replace(":", "/") process_model = get_process_model(process_model_identifier) - files = sorted(SpecFileService.get_files(process_model)) + files = sorted( + SpecFileService.get_files(process_model), + key=lambda f: "" if f.name == process_model.primary_file_name else f.sort_index, + ) process_model.files = files for file in process_model.files: file.references = SpecFileService.get_references_for_file(file, process_model)