diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/task_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/task_service.py
index 1614815c1..fef8265fb 100644
--- a/spiffworkflow-backend/src/spiffworkflow_backend/services/task_service.py
+++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/task_service.py
@@ -70,13 +70,13 @@ class TaskService:
for child_spiff_task in spiff_task.children:
if child_spiff_task._has_state(TaskState.PREDICTED_MASK):
self.__class__.remove_spiff_task_from_parent(child_spiff_task, self.task_models)
- else:
- self.update_task_model_with_spiff_task(
- spiff_task=child_spiff_task,
- )
- self.process_spiff_task_children(
- spiff_task=child_spiff_task,
- )
+ continue
+ self.update_task_model_with_spiff_task(
+ spiff_task=child_spiff_task,
+ )
+ self.process_spiff_task_children(
+ spiff_task=child_spiff_task,
+ )
def process_spiff_task_parents(
self,
@@ -148,7 +148,6 @@ class TaskService:
spiff_workflow: BpmnWorkflow,
bpmn_process: BpmnProcessModel,
) -> None:
- # import pdb; pdb.set_trace()
new_properties_json = copy.copy(bpmn_process.properties_json)
new_properties_json["last_task"] = str(spiff_workflow.last_task) if spiff_workflow.last_task else None
new_properties_json["success"] = spiff_workflow.success
diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/workflow_execution_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/workflow_execution_service.py
index 3fd433e59..43927b830 100644
--- a/spiffworkflow-backend/src/spiffworkflow_backend/services/workflow_execution_service.py
+++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/workflow_execution_service.py
@@ -126,13 +126,12 @@ class ExecutionStrategy:
def __init__(self, delegate: EngineStepDelegate):
"""__init__."""
self.delegate = delegate
- self.bpmn_process_instance = None
def do_engine_steps(self, bpmn_process_instance: BpmnWorkflow, exit_at: None = None) -> None:
pass
- def save(self) -> None:
- self.delegate.save(self.bpmn_process_instance)
+ def save(self, bpmn_process_instance: BpmnWorkflow) -> None:
+ self.delegate.save(bpmn_process_instance)
class GreedyExecutionStrategy(ExecutionStrategy):
@@ -238,7 +237,7 @@ class WorkflowExecutionService:
raise ApiError.from_workflow_exception("task_error", str(swe), swe) from swe
finally:
- self.execution_strategy.save()
+ self.execution_strategy.save(self.bpmn_process_instance)
db.session.commit()
if save:
diff --git a/spiffworkflow-backend/tests/data/manual_task/manual_task.bpmn b/spiffworkflow-backend/tests/data/manual_task/manual_task.bpmn
index f4d0190bc..ac1486e4b 100644
--- a/spiffworkflow-backend/tests/data/manual_task/manual_task.bpmn
+++ b/spiffworkflow-backend/tests/data/manual_task/manual_task.bpmn
@@ -7,8 +7,8 @@
Flow_0nnh2x9
-
-
+
+
## Hello
@@ -16,7 +16,7 @@
Flow_0nnh2x9
-
+
Flow_0stlaxe
Flow_1pmem7s
@@ -31,7 +31,7 @@
-
+
diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py
index 89fda503d..c5623f47b 100644
--- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py
+++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py
@@ -2616,6 +2616,8 @@ class TestProcessApi(BaseTest):
content_type="application/json",
data=json.dumps(data),
)
+ assert response.status_code == 200
+ assert response.json is not None
assert response.json["status"] == "complete"
response = client.get(
@@ -2641,9 +2643,9 @@ class TestProcessApi(BaseTest):
) -> None:
"""Test_script_unit_test_run."""
process_group_id = "test_group"
- process_model_id = "process_navigation"
- bpmn_file_name = "process_navigation.bpmn"
- bpmn_file_location = "process_navigation"
+ process_model_id = "manual_task"
+ bpmn_file_name = "manual_task.bpmn"
+ bpmn_file_location = "manual_task"
process_model_identifier = self.create_group_and_model_with_bpmn(
client=client,
user=with_super_admin_user,
@@ -2674,25 +2676,11 @@ class TestProcessApi(BaseTest):
headers=self.logged_in_headers(with_super_admin_user),
)
- data = {
- "dateTime": "PT1H",
- "external": True,
- "internal": True,
- "label": "Event_0e4owa3",
- "typename": "TimerEventDefinition",
- }
- response = client.post(
- f"/v1.0/send-event/{self.modify_process_identifier_for_path_param(process_model_identifier)}/{process_instance_id}",
- headers=self.logged_in_headers(with_super_admin_user),
- content_type="application/json",
- data=json.dumps(data),
- )
-
response = client.get(
f"/v1.0/process-instances/{self.modify_process_identifier_for_path_param(process_model_identifier)}/{process_instance_id}/task-info",
headers=self.logged_in_headers(with_super_admin_user),
)
- assert len(response.json) == 9
+ assert len(response.json) == 7
human_task = next(task for task in response.json if task["bpmn_identifier"] == "manual_task_one")
response = client.post(
@@ -2711,7 +2699,7 @@ class TestProcessApi(BaseTest):
headers=self.logged_in_headers(with_super_admin_user),
)
assert response.status_code == 200
- assert len(response.json) == 9
+ assert len(response.json) == 7
def setup_initial_groups_for_move_tests(self, client: FlaskClient, with_super_admin_user: UserModel) -> None:
"""Setup_initial_groups_for_move_tests."""
diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py
index c07f2c790..13a22cedf 100644
--- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py
+++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py
@@ -353,14 +353,24 @@ class TestProcessInstanceProcessor(BaseTest):
process_instance = ProcessInstanceModel.query.filter_by(id=process_instance.id).first()
processor = ProcessInstanceProcessor(process_instance)
- # with open("after_reset.json", 'w') as f: f.write(json.dumps(processor.serialize(), indent=2))
processor.resume()
processor.do_engine_steps(save=True)
human_task_one = process_instance.active_human_tasks[0]
spiff_manual_task = processor.bpmn_process_instance.get_task_from_id(UUID(human_task_one.task_id))
ProcessInstanceService.complete_form_task(processor, spiff_manual_task, {}, initiator_user, human_task_one)
- assert process_instance.status == "complete"
+ process_instance = ProcessInstanceModel.query.filter_by(id=process_instance.id).first()
+ processor = ProcessInstanceProcessor(process_instance)
+ human_task_one = process_instance.active_human_tasks[0]
+ spiff_manual_task = processor.bpmn_process_instance.get_task_from_id(UUID(human_task_one.task_id))
+ ProcessInstanceService.complete_form_task(processor, spiff_manual_task, {}, initiator_user, human_task_one)
+ human_task_one = process_instance.active_human_tasks[0]
+ spiff_manual_task = processor.bpmn_process_instance.get_task_from_id(UUID(human_task_one.task_id))
+ ProcessInstanceService.complete_form_task(processor, spiff_manual_task, {}, initiator_user, human_task_one)
+
+ # recreate variables to ensure all bpmn json was recreated from scratch from the db
+ process_instance_relookup = ProcessInstanceModel.query.filter_by(id=process_instance.id).first()
+ assert process_instance_relookup.status == "complete"
def test_properly_saves_tasks_when_running(
self,