Add flag to indicate if user filtered

This commit is contained in:
Jon Herron 2022-11-16 15:02:33 -05:00
parent 55020ed382
commit 62da258107
2 changed files with 30 additions and 9 deletions

View File

@ -439,6 +439,12 @@ paths:
description: For filtering - not_started, user_input_required, waiting, complete, error, or suspended
schema:
type: string
- name: user_filter
in: query
required: false
description: For filtering - indicates the user has manually entered a query
schema:
type: boolean
# process_instance_list
get:
operationId: spiffworkflow_backend.routes.process_api_blueprint.process_instance_list

View File

@ -74,6 +74,7 @@ from spiffworkflow_backend.services.process_instance_processor import (
)
from spiffworkflow_backend.services.process_instance_report_service import (
ProcessInstanceReportService,
ProcessInstanceReportFilter,
)
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
@ -732,18 +733,32 @@ def process_instance_list(
end_from: Optional[int] = None,
end_to: Optional[int] = None,
process_status: Optional[str] = None,
user_filter: Optional[bool] = False,
) -> flask.wrappers.Response:
"""Process_instance_list."""
process_instance_report = ProcessInstanceReportModel.default_report(g.user)
report_filter = ProcessInstanceReportService.filter_from_metadata_with_overrides(
process_instance_report,
process_model_identifier,
start_from,
start_to,
end_from,
end_to,
process_status,
)
print(f"user_filter: {user_filter}")
if user_filter:
report_filter = ProcessInstanceReportFilter(
process_model_identifier,
start_from,
start_to,
end_from,
end_to,
process_status,
)
else:
report_filter = ProcessInstanceReportService.filter_from_metadata_with_overrides(
process_instance_report,
process_model_identifier,
start_from,
start_to,
end_from,
end_to,
process_status,
)
# process_model_identifier = un_modify_modified_process_model_id(modified_process_model_identifier)
process_instance_query = ProcessInstanceModel.query