updated with tasks waiting for me query to include tasks manually assigned to the user w/ burnettk (#467)

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2023-09-07 13:41:41 -04:00 committed by GitHub
parent a30bb6cca3
commit ecba3f7c38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -553,13 +553,30 @@ class ProcessInstanceReportService:
HumanTaskModel,
and_(
HumanTaskModel.process_instance_id == ProcessInstanceModel.id,
HumanTaskModel.lane_assignment_id.is_(None), # type: ignore
HumanTaskModel.completed.is_(False), # type: ignore
),
).join(
HumanTaskUserModel,
and_(HumanTaskUserModel.human_task_id == HumanTaskModel.id, HumanTaskUserModel.user_id == user.id),
)
user_group_assignment_for_lane_assignment = aliased(UserGroupAssignmentModel)
process_instance_query = process_instance_query.outerjoin(
user_group_assignment_for_lane_assignment,
and_(
user_group_assignment_for_lane_assignment.group_id == HumanTaskModel.lane_assignment_id,
user_group_assignment_for_lane_assignment.user_id == user.id,
),
).filter(
# it should show up in your "Waiting for me" list IF:
# 1) task is not assigned to a group OR
# 2) you are not in the group
# In the case of number 2, it probably means you were added to the task individually by an admin
or_(
HumanTaskModel.lane_assignment_id.is_(None), # type: ignore
user_group_assignment_for_lane_assignment.group_id.is_(None),
)
)
human_task_already_joined = True
restrict_human_tasks_to_user = user