From 01ffb43c23d4c6e8f7328ddde144158091ffeb15 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Tue, 2 Apr 2019 18:37:55 +0200 Subject: [PATCH] Include old activites assigned to the task [SCI-3285] --- app/services/activities_service.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/services/activities_service.rb b/app/services/activities_service.rb index fafe747c4..b81dc24d1 100644 --- a/app/services/activities_service.rb +++ b/app/services/activities_service.rb @@ -13,10 +13,13 @@ class ActivitiesService query = query.where('project_id IN (?)', subjects_with_children[:Project]) subjects_with_children.except!(:Project) end - query = query.where( - subjects_with_children.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR '), - *subjects_with_children.flatten - ) + where_condition = subjects_with_children.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR ') + where_arguments = subjects_with_children.flatten + if subjects_with_children[:MyModule] + where_condition = where_condition.concat(' OR (my_module_id IN(?))') + where_arguments << subjects_with_children[:MyModule] + end + query = query.where(where_condition, *where_arguments) end query = query.where(owner_id: filters[:users]) if filters[:users]