mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 18:52:07 +08:00
fixes loading samples error in blank project
This commit is contained in:
parent
890b0ba860
commit
deb739efa6
1 changed files with 12 additions and 5 deletions
|
@ -134,11 +134,18 @@ class SampleDatatable < AjaxDatatablesRails::Base
|
|||
@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)
|
||||
if ids.blank?
|
||||
samples = samples.joins('LEFT OUTER JOIN sample_my_modules ON
|
||||
(samples.id = sample_my_modules.sample_id AND
|
||||
sample_my_modules.id IS NULL)')
|
||||
.references(:sample_my_modules)
|
||||
else
|
||||
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)
|
||||
end
|
||||
elsif @experiment
|
||||
@assigned_samples = @experiment.assigned_samples
|
||||
ids = @experiment.my_modules.select(:id)
|
||||
|
|
Loading…
Reference in a new issue