From f9000d4dc540eb749bd1ded4969596694e125b63 Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 4 Apr 2023 15:48:34 -0400 Subject: [PATCH] make sure we prcoess the parents and children of failing spiff tasks as well since these do not go through the normal flow w/ burnettk --- .../routes/process_instances_controller.py | 12 +++++++----- .../services/workflow_execution_service.py | 9 ++------- .../src/routes/ProcessInstanceShow.tsx | 5 +++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py index b17869ab1..432bd9c48 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py @@ -650,10 +650,12 @@ def process_instance_task_list( .add_columns( BpmnProcessDefinitionModel.bpmn_identifier.label("bpmn_process_definition_identifier"), # type: ignore BpmnProcessDefinitionModel.bpmn_name.label("bpmn_process_definition_name"), # type: ignore - direct_parent_bpmn_process_alias.guid.label("bpmn_process_direct_parent_guid"), - direct_parent_bpmn_process_definition_alias.bpmn_identifier.label( - "bpmn_process_direct_parent_bpmn_identifier" - ), + bpmn_process_alias.guid.label("bpmn_process_guid"), + # not sure why we needed these + # direct_parent_bpmn_process_alias.guid.label("bpmn_process_direct_parent_guid"), + # direct_parent_bpmn_process_definition_alias.bpmn_identifier.label( + # "bpmn_process_direct_parent_bpmn_identifier" + # ), TaskDefinitionModel.bpmn_identifier, TaskDefinitionModel.bpmn_name, TaskDefinitionModel.typename, @@ -672,7 +674,7 @@ def process_instance_task_list( task_model_list = {} if most_recent_tasks_only: for task_model in task_models: - bpmn_process_guid = task_model.bpmn_process_direct_parent_guid or "TOP" + bpmn_process_guid = task_model.bpmn_process_guid or "TOP" row_key = f"{bpmn_process_guid}:::{task_model.bpmn_identifier}" if row_key not in task_model_list: task_model_list[row_key] = task_model diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/workflow_execution_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/workflow_execution_service.py index babff151f..5398fff45 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/workflow_execution_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/workflow_execution_service.py @@ -92,6 +92,8 @@ class TaskModelSavingDelegate(EngineStepDelegate): if hasattr(script_engine, "failing_spiff_task") and script_engine.failing_spiff_task is not None: failing_spiff_task = script_engine.failing_spiff_task self.task_service.update_task_model_with_spiff_task(failing_spiff_task, task_failed=True) + self.task_service.process_spiff_task_parent_subprocess_tasks(failing_spiff_task) + self.task_service.process_spiff_task_children(failing_spiff_task) self.task_service.save_objects_to_database() @@ -101,13 +103,6 @@ class TaskModelSavingDelegate(EngineStepDelegate): def after_engine_steps(self, bpmn_process_instance: BpmnWorkflow) -> None: if self._should_update_task_model(): - # TODO: also include children of the last task processed. This may help with task resets - # if we have to set their states to FUTURE. - # excludes FUTURE and COMPLETED. the others were required to get PP1 to go to completion. - # for waiting_spiff_task in bpmn_process_instance.get_tasks( - # TaskState.WAITING | TaskState.CANCELLED | TaskState.READY | TaskState.MAYBE | TaskState.LIKELY - # ): - # self._update_task_model_with_spiff_task(waiting_spiff_task) if self.last_completed_spiff_task is not None: self.task_service.process_spiff_task_parent_subprocess_tasks(self.last_completed_spiff_task) self.task_service.process_spiff_task_children(self.last_completed_spiff_task) diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx index 7ae4d4ce2..29d4bedcb 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx @@ -998,6 +998,11 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { ): {taskToUse.state} {taskDisplayButtons(taskToUse)} +
+ + Guid: {taskToUse.guid} + +
{taskToUse.state === 'COMPLETED' ? (