From 8884d32cd6dab266a29bceb4f33b8726be91f506 Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 24 Jun 2022 16:16:05 -0400 Subject: [PATCH] fixed minor types w/ burnettk --- src/spiffworkflow_backend/models/process_instance.py | 2 +- src/spiffworkflow_backend/models/process_model.py | 2 +- src/spiffworkflow_backend/services/error_handling_service.py | 3 +-- .../services/process_instance_processor.py | 2 +- src/spiffworkflow_backend/services/process_instance_service.py | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/spiffworkflow_backend/models/process_instance.py b/src/spiffworkflow_backend/models/process_instance.py index 51687c83..7bb8d97b 100644 --- a/src/spiffworkflow_backend/models/process_instance.py +++ b/src/spiffworkflow_backend/models/process_instance.py @@ -231,7 +231,7 @@ class ProcessInstanceMetadata: description: str | None = None spec_version: str | None = None state: str | None = None - status: ProcessInstanceStatus | None = None + status: str | None = None total_tasks: int | None = None completed_tasks: int | None = None is_review: bool | None = None diff --git a/src/spiffworkflow_backend/models/process_model.py b/src/spiffworkflow_backend/models/process_model.py index 196ae88a..d39527d0 100644 --- a/src/spiffworkflow_backend/models/process_model.py +++ b/src/spiffworkflow_backend/models/process_model.py @@ -40,7 +40,7 @@ class ProcessModelInfo: display_order: int | None = 0 is_review: bool = False files: list[File] | None = field(default_factory=list[File]) - fault_or_suspend_on_exception: NotificationType = NotificationType.fault.value + fault_or_suspend_on_exception: str = NotificationType.fault.value exception_notification_addresses: list[str] = field(default_factory=list) def __post_init__(self) -> None: diff --git a/src/spiffworkflow_backend/services/error_handling_service.py b/src/spiffworkflow_backend/services/error_handling_service.py index 90c87282..a752986c 100644 --- a/src/spiffworkflow_backend/services/error_handling_service.py +++ b/src/spiffworkflow_backend/services/error_handling_service.py @@ -16,7 +16,7 @@ class ErrorHandlingService: """ErrorHandlingService.""" @staticmethod - def set_instance_status(instance_id: str, status: str) -> None: + def set_instance_status(instance_id: int, status: str) -> None: """Set_instance_status.""" instance = ( db.session.query(ProcessInstanceModel) @@ -26,7 +26,6 @@ class ErrorHandlingService: if instance: instance.status = status db.session.commit() - return instance def handle_error( self, _processor: ProcessInstanceProcessor, _error: Union[ApiError, Exception] diff --git a/src/spiffworkflow_backend/services/process_instance_processor.py b/src/spiffworkflow_backend/services/process_instance_processor.py index 13747fff..e0745ebd 100644 --- a/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/src/spiffworkflow_backend/services/process_instance_processor.py @@ -254,7 +254,7 @@ class ProcessInstanceProcessor: % (process_instance_model.id, e.__class__.__name__, str(e)) ) process_instance_model.bpmn_json = None - process_instance_model.status = ProcessInstanceStatus.not_started + process_instance_model.status = ProcessInstanceStatus.not_started.value # clear out any task assignments db.session.query(TaskEventModel).filter( diff --git a/src/spiffworkflow_backend/services/process_instance_service.py b/src/spiffworkflow_backend/services/process_instance_service.py index 4897bab3..69278bab 100644 --- a/src/spiffworkflow_backend/services/process_instance_service.py +++ b/src/spiffworkflow_backend/services/process_instance_service.py @@ -126,7 +126,7 @@ class ProcessInstanceService: else: return {} - def get_process_instance(self, process_instance_id: int) -> ProcessInstanceModel: + def get_process_instance(self, process_instance_id: int) -> Any: """Get_process_instance.""" result = ( db.session.query(ProcessInstanceModel)