allow process_status filter to be a csv string

This commit is contained in:
jasquat 2022-09-23 14:19:57 -04:00
parent a0eba9ed33
commit aea56fc750
3 changed files with 13 additions and 2 deletions

View File

@ -583,8 +583,9 @@ def process_instance_list(
ProcessInstanceModel.end_in_seconds <= end_till
)
if process_status is not None:
process_status_array = process_status.split(",")
process_instance_query = process_instance_query.filter(
ProcessInstanceModel.status == process_status
ProcessInstanceModel.status.in_(process_status_array) # type: ignore
)
process_instances = process_instance_query.order_by(

View File

@ -357,7 +357,7 @@ class ProcessInstanceProcessor:
@staticmethod
def __get_bpmn_process_instance(
process_instance_model: ProcessInstanceModel,
spec: WorkflowSpec = None,
spec: Optional[WorkflowSpec] = None,
validate_only: bool = False,
subprocesses: Optional[IdToBpmnProcessSpecMapping] = None,
) -> BpmnWorkflow:

View File

@ -1050,6 +1050,16 @@ class TestProcessApi(BaseTest):
assert len(results) == 1
assert results[0]["status"] == ProcessInstanceStatus[statuses[i]].value
response = client.get(
f"/v1.0/process-instances?process_status=not_started,complete&process_group_identifier={test_process_group_id}&process_model_identifier={test_process_model_id}",
headers=self.logged_in_headers(user),
)
assert response.json is not None
results = response.json["results"]
assert len(results) == 2
assert results[0]["status"] in ['complete', 'not_started']
assert results[1]["status"] in ['complete', 'not_started']
# filter by start/end seconds
# start > 1000 - this should eliminate the first
response = client.get(