From 4f2f73e7282affb8beac50933fa00b556686a954 Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 13 Dec 2022 16:04:37 -0500 Subject: [PATCH] store subprocesses for spiff steps as well and do not save file as primary if one is already set w/ burnettk --- .../spiffworkflow_backend/routes/process_api_blueprint.py | 3 ++- .../services/process_instance_processor.py | 5 ++++- .../src/spiffworkflow_backend/services/spec_file_service.py | 2 +- 3 files changed, 7 insertions(+), 3 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 0093c62e..2a81463c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -1433,7 +1433,8 @@ def process_instance_task_list( ) if step_detail is not None and process_instance.bpmn_json is not None: bpmn_json = json.loads(process_instance.bpmn_json) - bpmn_json["tasks"] = step_detail.task_json + bpmn_json["tasks"] = step_detail.task_json['tasks'] + bpmn_json["subprocesses"] = step_detail.task_json['subprocesses'] process_instance.bpmn_json = json.dumps(bpmn_json) processor = ProcessInstanceProcessor(process_instance) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index ffe69fd7..535f8282 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -551,7 +551,10 @@ class ProcessInstanceProcessor: """SaveSpiffStepDetails.""" bpmn_json = self.serialize() wf_json = json.loads(bpmn_json) - task_json = wf_json["tasks"] + task_json = { + "tasks": wf_json["tasks"], + "subprocesses": wf_json["subprocesses"] + } return { "process_instance_id": self.process_instance_model.id, diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py index c69f41c3..a31bc370 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py @@ -167,7 +167,7 @@ class SpecFileService(FileSystemService): for ref in references: # If no valid primary process is defined, default to the first process in the # updated file. - if not primary_process_ref and ref.type == "process" and ref.is_executable: + if not process_model_info.primary_file_name and not primary_process_ref and ref.type == "process" and ref.is_executable: ref.is_primary = True if ref.is_primary: