return next task when running an instance w/ burnettk

This commit is contained in:
jasquat 2022-11-08 12:36:11 -05:00
parent 5659ac7104
commit 9d4e096a5d
2 changed files with 16 additions and 1 deletions

View File

@ -7,6 +7,7 @@ from typing import Optional
from flask import current_app
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore
from SpiffWorkflow.task import Task as SpiffTask # type: ignore
from spiffworkflow_backend.models.process_instance import ProcessInstanceApi
@ -105,6 +106,20 @@ class ProcessInstanceService:
title=title_value,
)
next_task_trying_again = next_task
if (
not next_task
): # The Next Task can be requested to be a certain task, useful for parallel tasks.
# This may or may not work, sometimes there is no next task to complete.
next_task_trying_again = processor.next_task()
if next_task_trying_again is not None:
process_instance_api.next_task = (
ProcessInstanceService.spiff_task_to_api_task(
next_task_trying_again, add_docs_and_forms=True
)
)
return process_instance_api
def get_process_instance(self, process_instance_id: int) -> Any:

View File

@ -1123,7 +1123,7 @@ class TestProcessApi(BaseTest):
)
assert response.json is not None
# assert response.json['next_task'] is not None
assert response.json['next_task'] is not None
active_tasks = (
db.session.query(ActiveTaskModel)