From 286803d10bb545858946c0e32a3270142499fd06 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 8 Jun 2021 14:24:59 -0400 Subject: [PATCH] fixing a big stupid bug I created when merging all the code and making changes to the files. --- crc/api/workflow.py | 2 +- tests/test_user_roles.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/crc/api/workflow.py b/crc/api/workflow.py index 0466ff5d..bf180fef 100644 --- a/crc/api/workflow.py +++ b/crc/api/workflow.py @@ -216,7 +216,7 @@ def update_task(workflow_id, task_id, body, terminate_loop=None, update_all=Fals raise ApiError("invalid_state", "You may not update a task unless it is in the READY state. " "Consider calling a token reset to make this task Ready.") - if terminate_loop: + if terminate_loop and spiff_task.is_looping(): spiff_task.terminate_loop() # Extract the details specific to the form submitted diff --git a/tests/test_user_roles.py b/tests/test_user_roles.py index 7dadbefd..27ec4e32 100644 --- a/tests/test_user_roles.py +++ b/tests/test_user_roles.py @@ -269,3 +269,12 @@ class TestTasksApi(BaseTest): self.assertEqual(0, len(self.get_assignment_task_events(submitter.uid))) self.assertEqual(0, len(self.get_assignment_task_events(supervisor.uid))) + + def test_no_error_when_calling_end_loop_on_non_looping_task(self): + + workflow = self.create_workflow('hello_world') + workflow_api = self.get_workflow_api(workflow) + + data = workflow_api.next_task.data + data['name'] = "john" + workflow_api = self.complete_form(workflow, workflow_api.next_task, data, terminate_loop=True)