mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-27 10:08:11 +08:00
Feed the Hound part 3
This commit is contained in:
parent
9d4a67a5b6
commit
fd8187370e
1 changed files with 15 additions and 24 deletions
|
@ -125,38 +125,29 @@ class SampleDatatable < AjaxDatatablesRails::Base
|
|||
if @my_module
|
||||
@assigned_samples = @my_module.samples
|
||||
|
||||
samples = samples
|
||||
.joins(
|
||||
"LEFT OUTER JOIN sample_my_modules ON
|
||||
(samples.id = sample_my_modules.sample_id AND
|
||||
(sample_my_modules.my_module_id = #{@my_module.id.to_s} OR
|
||||
sample_my_modules.id IS NULL))"
|
||||
)
|
||||
.references(:sample_my_modules)
|
||||
samples = samples.joins("LEFT OUTER JOIN sample_my_modules ON
|
||||
(samples.id = sample_my_modules.sample_id AND
|
||||
(sample_my_modules.my_module_id = #{@my_module.id.to_s} OR
|
||||
sample_my_modules.id IS NULL))")
|
||||
.references(:sample_my_modules)
|
||||
elsif @project
|
||||
@assigned_samples = @project.assigned_samples
|
||||
ids = @project.my_modules_ids
|
||||
|
||||
samples = samples
|
||||
.joins(
|
||||
"LEFT OUTER JOIN sample_my_modules ON
|
||||
(samples.id = sample_my_modules.sample_id AND
|
||||
(sample_my_modules.my_module_id IN (#{ids}) OR
|
||||
sample_my_modules.id IS NULL))"
|
||||
)
|
||||
.references(:sample_my_modules)
|
||||
samples = samples.joins("LEFT OUTER JOIN sample_my_modules ON
|
||||
(samples.id = sample_my_modules.sample_id AND
|
||||
(sample_my_modules.my_module_id IN (#{ids}) OR
|
||||
sample_my_modules.id IS NULL))")
|
||||
.references(:sample_my_modules)
|
||||
elsif @experiment
|
||||
@assigned_samples = @experiment.assigned_samples
|
||||
ids = @experiment.my_modules.select(:id)
|
||||
|
||||
samples = samples
|
||||
.joins(
|
||||
"LEFT OUTER JOIN sample_my_modules ON
|
||||
(samples.id = sample_my_modules.sample_id AND
|
||||
(sample_my_modules.my_module_id IN (#{ids.to_sql}) OR
|
||||
sample_my_modules.id IS NULL))"
|
||||
)
|
||||
.references(:sample_my_modules)
|
||||
samples = samples.joins("LEFT OUTER JOIN sample_my_modules ON
|
||||
(samples.id = sample_my_modules.sample_id AND
|
||||
(sample_my_modules.my_module_id IN (#{ids.to_sql}) OR
|
||||
sample_my_modules.id IS NULL))")
|
||||
.references(:sample_my_modules)
|
||||
end
|
||||
|
||||
# Make mappings of custom fields, so we have same id for every column
|
||||
|
|
Loading…
Reference in a new issue