next_task returns the next available task, except when the task is completed when it returns the EndEvent -

The problem was that it was returning the first EndEvent it found, not the last one. This caused a problem when we had a CallActivity which has its own EndEvent.

Fixes #399
This commit is contained in:
Kelly McDonald 2021-07-27 09:19:08 -04:00
parent 2c892560ad
commit 217e61eed3
2 changed files with 7 additions and 2 deletions

View File

@ -389,10 +389,15 @@ class WorkflowProcessor(object):
"""
# If the whole blessed mess is done, return the end_event task in the tree
# This was failing in the case of a call activity where we have an intermediate EndEvent
# what we really want is the LAST EndEvent
endtasks = []
if self.bpmn_workflow.is_completed():
for task in SpiffTask.Iterator(self.bpmn_workflow.task_tree, SpiffTask.ANY_MASK):
if isinstance(task.task_spec, EndEvent):
return task
endtasks.append(task)
return endtasks[-1]
# If there are ready tasks to complete, return the next ready task, but return the one
# in the active parallel path if possible. In some cases the active parallel path may itself be

View File

@ -13,7 +13,7 @@ class TestCallActivityEndEvent(BaseTest):
# The call activity has 'Call Event'
# This should fail, but it passes
self.assertIn('Call Event', first_task.documentation)
#self.assertIn('Call Event', first_task.documentation)
# This should pass, but it fails
self.assertIn('Main Workflow', first_task.documentation)