mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-15 01:24:53 +08:00
Fix activities service [SCI-5485]
This commit is contained in:
parent
41cdc47702
commit
4f8e15dbc6
1 changed files with 4 additions and 4 deletions
|
@ -18,8 +18,8 @@ class ActivitiesService
|
||||||
query = query.where('project_id IN (?)', subjects_with_children['Project'])
|
query = query.where('project_id IN (?)', subjects_with_children['Project'])
|
||||||
subjects_with_children.except!('Project')
|
subjects_with_children.except!('Project')
|
||||||
end
|
end
|
||||||
where_condition = subjects_with_children.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR ')
|
where_condition = subjects_with_children.to_h.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR ')
|
||||||
where_arguments = subjects_with_children.flatten
|
where_arguments = subjects_with_children.to_h.flatten
|
||||||
if subjects_with_children[:my_module]
|
if subjects_with_children[:my_module]
|
||||||
where_condition = where_condition.concat(' OR (my_module_id IN(?))')
|
where_condition = where_condition.concat(' OR (my_module_id IN(?))')
|
||||||
where_arguments << subjects_with_children[:my_module]
|
where_arguments << subjects_with_children[:my_module]
|
||||||
|
@ -71,8 +71,8 @@ class ActivitiesService
|
||||||
subjects_with_children = load_subjects_children('MyModule': [my_module.id])
|
subjects_with_children = load_subjects_children('MyModule': [my_module.id])
|
||||||
query = Activity.where(project: my_module.experiment.project)
|
query = Activity.where(project: my_module.experiment.project)
|
||||||
query.where(
|
query.where(
|
||||||
subjects_with_children.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR '),
|
subjects_with_children.to_h.map { '(subject_type = ? AND subject_id IN(?))' }.join(' OR '),
|
||||||
*subjects_with_children.flatten
|
*subjects_with_children.to_h.flatten
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue