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:
parent
2c892560ad
commit
217e61eed3
|
@ -389,10 +389,15 @@ class WorkflowProcessor(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# If the whole blessed mess is done, return the end_event task in the tree
|
# 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():
|
if self.bpmn_workflow.is_completed():
|
||||||
for task in SpiffTask.Iterator(self.bpmn_workflow.task_tree, SpiffTask.ANY_MASK):
|
for task in SpiffTask.Iterator(self.bpmn_workflow.task_tree, SpiffTask.ANY_MASK):
|
||||||
if isinstance(task.task_spec, EndEvent):
|
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
|
# 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
|
# in the active parallel path if possible. In some cases the active parallel path may itself be
|
||||||
|
|
|
@ -13,7 +13,7 @@ class TestCallActivityEndEvent(BaseTest):
|
||||||
# The call activity has 'Call Event'
|
# The call activity has 'Call Event'
|
||||||
|
|
||||||
# This should fail, but it passes
|
# 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
|
# This should pass, but it fails
|
||||||
self.assertIn('Main Workflow', first_task.documentation)
|
self.assertIn('Main Workflow', first_task.documentation)
|
||||||
|
|
Loading…
Reference in New Issue