From 43bf8f5337240d2dd94fed9be7a4ebdaf6cfb53f Mon Sep 17 00:00:00 2001 From: Dan Funk Date: Sat, 16 May 2020 15:33:06 -0400 Subject: [PATCH 1/2] Fixing a bug with navigation where elements went missing past exclusive gateways on subsequent forks. --- Pipfile.lock | 8 ++++---- crc/api/workflow.py | 3 +++ tests/test_tasks_api.py | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 58285c07..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": [ @@ -912,10 +912,10 @@ }, "more-itertools": { "hashes": [ - "sha256:5dd8bcf33e5f9513ffa06d5ad33d78f31e1931ac9a18f33d37e77a180d393a7c", - "sha256:b1ddb932186d8a6ac451e1d95844b382f55e12686d51ca0c68b6f61f2ab7a507" + "sha256:558bb897a2232f5e4f8e2399089e35aecb746e1f9191b6584a151647e89267be", + "sha256:7818f596b1e87be009031c7653d01acc46ed422e6656b394b0f765ce66ed4982" ], - "version": "==8.2.0" + "version": "==8.3.0" }, "packaging": { "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/test_tasks_api.py b/tests/test_tasks_api.py index 5edfa686..b65ffb5d 100644 --- a/tests/test_tasks_api.py +++ b/tests/test_tasks_api.py @@ -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() From 7a380fdeb466f5ec0f1ffdecb7ef928dd50fc42c Mon Sep 17 00:00:00 2001 From: Dan Funk Date: Sat, 16 May 2020 15:38:15 -0400 Subject: [PATCH 2/2] Forgot to fix another test and to add the example file used for a previous test. --- .../exclusive_gateway_2.bpmn | 143 ++++++++++++++++++ tests/test_tasks_api.py | 2 +- 2 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 tests/data/exclusive_gateway_2/exclusive_gateway_2.bpmn 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 b65ffb5d..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'])