Fix activities service [SCI-5485]

This commit is contained in:
aignatov-bio 2021-02-15 10:23:32 +01:00
parent 41cdc47702
commit 4f8e15dbc6

View file

@ -18,8 +18,8 @@ class ActivitiesService
query = query.where('project_id IN (?)', subjects_with_children['Project'])
subjects_with_children.except!('Project')
end
where_condition = subjects_with_children.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR ')
where_arguments = subjects_with_children.flatten
where_condition = subjects_with_children.to_h.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR ')
where_arguments = subjects_with_children.to_h.flatten
if subjects_with_children[:my_module]
where_condition = where_condition.concat(' OR (my_module_id IN(?))')
where_arguments << subjects_with_children[:my_module]
@ -71,8 +71,8 @@ class ActivitiesService
subjects_with_children = load_subjects_children('MyModule': [my_module.id])
query = Activity.where(project: my_module.experiment.project)
query.where(
subjects_with_children.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR '),
*subjects_with_children.flatten
subjects_with_children.to_h.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR '),
*subjects_with_children.to_h.flatten
)
end
end