diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index 1639902b..97904dba 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -1148,7 +1148,7 @@ def task_list_my_tasks(page: int = 1, per_page: int = 100) -> flask.wrappers.Res # just need this add_columns to add the process_model_identifier. Then add everything back that was removed. .add_columns( ProcessInstanceModel.process_model_identifier, - ProcessInstanceModel.process_group_identifier, + ProcessInstanceModel.process_model_display_name, ProcessInstanceModel.status, ActiveTaskModel.task_name, ActiveTaskModel.task_title, diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index c553cfcd..d74e5722 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -45,6 +45,19 @@ class ProcessModelService(FileSystemService): return True return False + @classmethod + def is_group_identifier(cls, process_group_identifier: str) -> bool: + if os.path.exists(FileSystemService.root_path()): + process_group_path = os.path.abspath( + os.path.join( + FileSystemService.root_path(), + FileSystemService.id_string_to_relative_path(process_group_identifier), + ) + ) + return cls.is_group(process_group_path) + + return False + @classmethod def is_model(cls, path: str) -> bool: """Is_model.""" @@ -53,6 +66,19 @@ class ProcessModelService(FileSystemService): return True return False + @classmethod + def is_model_identifier(cls, process_model_identifier: str) -> bool: + if os.path.exists(FileSystemService.root_path()): + process_model_path = os.path.abspath( + os.path.join( + FileSystemService.root_path(), + FileSystemService.id_string_to_relative_path(process_model_identifier), + ) + ) + return cls.is_model(process_model_path) + + return False + @staticmethod def write_json_file( file_path: str, json_data: dict, indent: int = 4, sort_keys: bool = True diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py index 5821efb9..83a376be 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py @@ -252,9 +252,9 @@ class BaseTest: There must be an existing process model to instantiate. """ - if not ProcessModelService.is_model(test_process_model_id): + if not ProcessModelService.is_model_identifier(test_process_model_id): dirname = os.path.dirname(test_process_model_id) - if not ProcessModelService.is_group(dirname): + if not ProcessModelService.is_group_identifier(dirname): process_group = ProcessGroup(id=dirname, display_name=dirname) ProcessModelService.add_process_group(process_group) basename = os.path.basename(test_process_model_id) 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 9216077c..307179de 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -1548,7 +1548,7 @@ class TestProcessApi(BaseTest): status=ProcessInstanceStatus[statuses[i]].value, process_initiator=with_super_admin_user, process_model_identifier=process_model_identifier, - process_group_identifier="test_process_group_id", + process_model_display_name=process_model_identifier, updated_at_in_seconds=round(time.time()), start_in_seconds=(1000 * i) + 1000, end_in_seconds=(1000 * i) + 2000,