From dfe958d386f2368d183a08474c4d524928eadf12 Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 20 Dec 2022 15:41:01 -0500 Subject: [PATCH 1/2] fixed completed instances filter w/ burnettk --- .../services/process_instance_report_service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py index 773533ae..d04b81f9 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py @@ -380,7 +380,11 @@ class ProcessInstanceReportService: ProcessInstanceModel.status.in_(ProcessInstanceModel.terminal_statuses()) # type: ignore ) - if report_filter.with_relation_to_me is True: + if ( + not report_filter.with_tasks_completed_by_me + and not report_filter.with_tasks_assigned_to_my_group + and report_filter.with_relation_to_me is True + ): process_instance_query = process_instance_query.outerjoin( HumanTaskModel ).outerjoin( From 9e6218e89cee51bd45d2e3be153f19e14d072bb9 Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 20 Dec 2022 16:02:27 -0500 Subject: [PATCH 2/2] fixed get tasks and process instances by group w/ burnettk --- .../src/spiffworkflow_backend/api.yml | 6 +++--- .../services/process_instance_report_service.py | 17 +++++++---------- .../src/components/TasksWaitingForMyGroups.tsx | 2 +- .../src/routes/CompletedInstances.tsx | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index 0d3a4afe..12b40160 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -601,7 +601,7 @@ paths: description: Specifies the identifier of a report to use, if any schema: type: integer - - name: group_identifier + - name: user_group_identifier in: query required: false description: The identifier of the group to get the process instances for @@ -714,7 +714,7 @@ paths: description: Specifies the identifier of a report to use, if any schema: type: integer - - name: group_identifier + - name: user_group_identifier in: query required: false description: The identifier of the group to get the process instances for @@ -1328,7 +1328,7 @@ paths: /tasks/for-my-groups: parameters: - - name: group_identifier + - name: user_group_identifier in: query required: false description: The identifier of the group to get the tasks for diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py index d04b81f9..82a35fc5 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py @@ -414,17 +414,14 @@ class ProcessInstanceReportService: ) if report_filter.with_tasks_assigned_to_my_group is True: + group_model_join_conditions = [GroupModel.id == HumanTaskModel.lane_assignment_id] if report_filter.user_group_identifier: - process_instance_query = process_instance_query.join( - GroupModel, - GroupModel.identifier == report_filter.user_group_identifier, - ) - else: - process_instance_query = process_instance_query.join(HumanTaskModel) - process_instance_query = process_instance_query.join( - GroupModel, - GroupModel.id == HumanTaskModel.lane_assignment_id, - ) + group_model_join_conditions.append(GroupModel.identifier == report_filter.user_group_identifier) + process_instance_query = process_instance_query.join(HumanTaskModel) + process_instance_query = process_instance_query.join( + GroupModel, + and_(*group_model_join_conditions) + ) process_instance_query = process_instance_query.join( UserGroupAssignmentModel, UserGroupAssignmentModel.group_id == GroupModel.id, diff --git a/spiffworkflow-frontend/src/components/TasksWaitingForMyGroups.tsx b/spiffworkflow-frontend/src/components/TasksWaitingForMyGroups.tsx index b7515c91..dab0372b 100644 --- a/spiffworkflow-frontend/src/components/TasksWaitingForMyGroups.tsx +++ b/spiffworkflow-frontend/src/components/TasksWaitingForMyGroups.tsx @@ -21,7 +21,7 @@ export default function TasksWaitingForMyGroups() { return ( );