set the completed by user on human task w/ burnettk
This commit is contained in:
parent
4e13d8f2cb
commit
c1ad29f518
|
@ -573,10 +573,9 @@ class ProcessInstanceProcessor:
|
|||
)
|
||||
return details_model
|
||||
|
||||
def save_spiff_step_details(self, human_task: HumanTaskModel) -> None:
|
||||
def save_spiff_step_details(self) -> None:
|
||||
"""SaveSpiffStepDetails."""
|
||||
details_model = self.spiff_step_details()
|
||||
# details_model.lane_assignment_id = human_task.lane_assignment_id
|
||||
db.session.add(details_model)
|
||||
db.session.commit()
|
||||
|
||||
|
@ -1180,11 +1179,16 @@ class ProcessInstanceProcessor:
|
|||
)
|
||||
return user_tasks # type: ignore
|
||||
|
||||
def complete_task(self, task: SpiffTask, human_task: HumanTaskModel) -> None:
|
||||
def complete_task(
|
||||
self, task: SpiffTask, human_task: HumanTaskModel, user: UserModel
|
||||
) -> None:
|
||||
"""Complete_task."""
|
||||
self.increment_spiff_step()
|
||||
self.bpmn_process_instance.complete_task_from_id(task.id)
|
||||
self.save_spiff_step_details(human_task)
|
||||
human_task.completed_by_user_id = user.id
|
||||
db.session.add(human_task)
|
||||
db.session.commit()
|
||||
self.save_spiff_step_details()
|
||||
|
||||
def get_data(self) -> dict[str, Any]:
|
||||
"""Get_data."""
|
||||
|
|
|
@ -210,7 +210,7 @@ class ProcessInstanceService:
|
|||
dot_dct = ProcessInstanceService.create_dot_dict(data)
|
||||
spiff_task.update_data(dot_dct)
|
||||
# ProcessInstanceService.post_process_form(spiff_task) # some properties may update the data store.
|
||||
processor.complete_task(spiff_task, human_task)
|
||||
processor.complete_task(spiff_task, human_task, user=user)
|
||||
processor.do_engine_steps(save=True)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -179,6 +179,7 @@ class TestProcessInstanceProcessor(BaseTest):
|
|||
ProcessInstanceService.complete_form_task(
|
||||
processor, spiff_task, {}, initiator_user, human_task
|
||||
)
|
||||
assert human_task.completed_by_user_id == initiator_user.id
|
||||
|
||||
assert len(process_instance.human_tasks) == 1
|
||||
human_task = process_instance.human_tasks[0]
|
||||
|
@ -198,6 +199,7 @@ class TestProcessInstanceProcessor(BaseTest):
|
|||
ProcessInstanceService.complete_form_task(
|
||||
processor, spiff_task, {}, finance_user_three, human_task
|
||||
)
|
||||
assert human_task.completed_by_user_id == finance_user_three.id
|
||||
assert len(process_instance.human_tasks) == 1
|
||||
human_task = process_instance.human_tasks[0]
|
||||
assert human_task.lane_assignment_id is None
|
||||
|
@ -215,6 +217,7 @@ class TestProcessInstanceProcessor(BaseTest):
|
|||
ProcessInstanceService.complete_form_task(
|
||||
processor, spiff_task, {}, finance_user_four, human_task
|
||||
)
|
||||
assert human_task.completed_by_user_id == finance_user_four.id
|
||||
assert len(process_instance.human_tasks) == 1
|
||||
human_task = process_instance.human_tasks[0]
|
||||
assert human_task.lane_assignment_id is None
|
||||
|
@ -250,7 +253,7 @@ class TestProcessInstanceProcessor(BaseTest):
|
|||
with_db_and_bpmn_file_cleanup: None,
|
||||
with_super_admin_user: UserModel,
|
||||
) -> None:
|
||||
"""Test_sets_permission_correctly_on_human_task_when_using_dict."""
|
||||
"""Test_does_not_recreate_human_tasks_on_multiple_saves."""
|
||||
self.create_process_group(
|
||||
client, with_super_admin_user, "test_group", "test_group"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue