dev_home
cxt 5 years ago
parent c282bf6d92
commit 2da7567c16

@ -5,9 +5,9 @@ class Users::ShixunsController < Users::BaseController
## 云上实验室过滤 ## 云上实验室过滤
if current_laboratory.main_site? if current_laboratory.main_site?
not_shixun_ids = Shixun.joins(:laboratory_shixuns).where("laboratory_shixuns.laboratory_id != #{current_laboratory.id}") not_shixun_ids = Shixun.joins(:laboratory_shixuns).where("laboratory_shixuns.laboratory_id != #{current_laboratory.id}")
@shixuns = @shixuns.where.not(id: not_shixun_ids) shixuns = shixuns.where.not(id: not_shixun_ids)
else else
@shixuns = @shixuns.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: current_laboratory.id }) shixuns = shixuns.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: current_laboratory.id })
end end
@count = shixuns.count @count = shixuns.count

@ -5,9 +5,9 @@ class Users::SubjectsController < Users::BaseController
## 云上实验室过滤 ## 云上实验室过滤
if current_laboratory.main_site? if current_laboratory.main_site?
not_subject_ids = Subject.joins(:laboratory_subjects).where("laboratory_subjects.laboratory_id != #{current_laboratory.id}") not_subject_ids = Subject.joins(:laboratory_subjects).where("laboratory_subjects.laboratory_id != #{current_laboratory.id}")
@subjects = @subjects.where.not(id: not_subject_ids) subjects = subjects.where.not(id: not_subject_ids)
else else
@subjects = @subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id }) subjects = subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id })
end end
@count = subjects.count @count = subjects.count

Loading…
Cancel
Save