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

This commit is contained in:
jasquat 2023-04-04 15:48:34 -04:00
parent 77a1c1a3db
commit b69b9f7d2a
3 changed files with 14 additions and 12 deletions

View File

@ -650,10 +650,12 @@ def process_instance_task_list(
.add_columns( .add_columns(
BpmnProcessDefinitionModel.bpmn_identifier.label("bpmn_process_definition_identifier"), # type: ignore BpmnProcessDefinitionModel.bpmn_identifier.label("bpmn_process_definition_identifier"), # type: ignore
BpmnProcessDefinitionModel.bpmn_name.label("bpmn_process_definition_name"), # type: ignore BpmnProcessDefinitionModel.bpmn_name.label("bpmn_process_definition_name"), # type: ignore
direct_parent_bpmn_process_alias.guid.label("bpmn_process_direct_parent_guid"), bpmn_process_alias.guid.label("bpmn_process_guid"),
direct_parent_bpmn_process_definition_alias.bpmn_identifier.label( # not sure why we needed these
"bpmn_process_direct_parent_bpmn_identifier" # 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_identifier,
TaskDefinitionModel.bpmn_name, TaskDefinitionModel.bpmn_name,
TaskDefinitionModel.typename, TaskDefinitionModel.typename,
@ -672,7 +674,7 @@ def process_instance_task_list(
task_model_list = {} task_model_list = {}
if most_recent_tasks_only: if most_recent_tasks_only:
for task_model in task_models: 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}" row_key = f"{bpmn_process_guid}:::{task_model.bpmn_identifier}"
if row_key not in task_model_list: if row_key not in task_model_list:
task_model_list[row_key] = task_model task_model_list[row_key] = task_model

View File

@ -92,6 +92,8 @@ class TaskModelSavingDelegate(EngineStepDelegate):
if hasattr(script_engine, "failing_spiff_task") and script_engine.failing_spiff_task is not None: if hasattr(script_engine, "failing_spiff_task") and script_engine.failing_spiff_task is not None:
failing_spiff_task = script_engine.failing_spiff_task 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.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() self.task_service.save_objects_to_database()
@ -101,13 +103,6 @@ class TaskModelSavingDelegate(EngineStepDelegate):
def after_engine_steps(self, bpmn_process_instance: BpmnWorkflow) -> None: def after_engine_steps(self, bpmn_process_instance: BpmnWorkflow) -> None:
if self._should_update_task_model(): 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: 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_parent_subprocess_tasks(self.last_completed_spiff_task)
self.task_service.process_spiff_task_children(self.last_completed_spiff_task) self.task_service.process_spiff_task_children(self.last_completed_spiff_task)

View File

@ -998,6 +998,11 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
): {taskToUse.state} ): {taskToUse.state}
{taskDisplayButtons(taskToUse)} {taskDisplayButtons(taskToUse)}
</Stack> </Stack>
<div>
<Stack orientation="horizontal" gap={2}>
Guid: {taskToUse.guid}
</Stack>
</div>
{taskToUse.state === 'COMPLETED' ? ( {taskToUse.state === 'COMPLETED' ? (
<div> <div>
<Stack orientation="horizontal" gap={2}> <Stack orientation="horizontal" gap={2}>