diff --git a/Pipfile.lock b/Pipfile.lock index 8cea2bc8..d95c9014 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -783,7 +783,7 @@ "spiffworkflow": { "editable": true, "git": "https://github.com/sartography/SpiffWorkflow.git", - "ref": "661902387021f7130ae27fa35434eb3b2c138610" + "ref": "29afbcd69d7bb266c7b08962b5f0b36fdbc4636b" }, "sqlalchemy": { "hashes": [ diff --git a/crc/api/workflow.py b/crc/api/workflow.py index 8f5b751c..368560d3 100644 --- a/crc/api/workflow.py +++ b/crc/api/workflow.py @@ -93,6 +93,9 @@ def __get_workflow_api_model(processor: WorkflowProcessor, next_task = None): spiff_task = processor.bpmn_workflow.get_task(nav_item['task_id']) if 'description' in nav_item: nav_item['title'] = nav_item.pop('description') + # fixme: duplicate code from the workflow_service. Should only do this in one place. + if ' ' in nav_item['title']: + nav_item['title'] = nav_item['title'].partition(' ')[2] else: nav_item['title'] = "" if spiff_task: diff --git a/tests/data/exclusive_gateway_2/exclusive_gateway_2.bpmn b/tests/data/exclusive_gateway_2/exclusive_gateway_2.bpmn new file mode 100644 index 00000000..c1709d77 --- /dev/null +++ b/tests/data/exclusive_gateway_2/exclusive_gateway_2.bpmn @@ -0,0 +1,143 @@ + + + + + Flow_1ux3ndu + + + + Flow_1ut95vk + Flow_1fok0lz + Flow_01he29w + + + + which_branch == 'a' + + + which_branch == 'b' + + + Flow_03ddkww + Flow_0ozlczo + Flow_1ph05b1 + + + + + + + + + + + + + + Flow_1ux3ndu + Flow_1ut95vk + + + + + + + + Flow_1fok0lz + Flow_03ddkww + + + + + + + + Flow_01he29w + Flow_0ozlczo + + + + + + + + Flow_1ph05b1 + Flow_0kr8pvy + + + Flow_0kr8pvy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_tasks_api.py b/tests/test_tasks_api.py index 5edfa686..b734ac97 100644 --- a/tests/test_tasks_api.py +++ b/tests/test_tasks_api.py @@ -154,7 +154,7 @@ class TestTasksApi(BaseTest): self.assertIsNotNone(workflow_api.navigation) nav = workflow_api.navigation - self.assertEquals(5, len(nav)) + self.assertEquals(6, len(nav)) self.assertEquals("Do You Have Bananas", nav[0]['title']) self.assertEquals("READY", nav[0]['state']) self.assertEquals("Bananas?", nav[1]['title']) @@ -162,6 +162,23 @@ class TestTasksApi(BaseTest): self.assertEquals("yes", nav[2]['title']) self.assertEquals("NOOP", nav[2]['state']) + def test_navigation_with_exclusive_gateway(self): + self.load_example_data() + workflow = self.create_workflow('exclusive_gateway_2') + + # get the first form in the two form workflow. + workflow_api = self.get_workflow_api(workflow) + self.assertIsNotNone(workflow_api.navigation) + nav = workflow_api.navigation + self.assertEquals(7, len(nav)) + self.assertEquals("Task 1", nav[0]['title']) + self.assertEquals("Which Branch?", nav[1]['title']) + self.assertEquals("a", nav[2]['title']) + self.assertEquals("Task 2a", nav[3]['title']) + self.assertEquals("b", nav[4]['title']) + self.assertEquals("Task 2b", nav[5]['title']) + self.assertEquals("Task 3", nav[6]['title']) + def test_document_added_to_workflow_shows_up_in_file_list(self): self.load_example_data()