From 15f7bcbbe7a5ffc9d4534b50d6658c87b551b37a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 15 Nov 2019 16:12:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index f128746ef..cbf4fee2b 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -24,11 +24,11 @@ class SubjectsController < ApplicationController # ζœ€ηƒ­ζŽ’εΊ if reorder == "myshixun_count" 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}").pluck(:id) not_subject_ids = not_subject_ids.length > 0 ? "(" + not_subject_ids.join(",") + ")" : "(-1)" laboratory_join = " AND subjects.id not in #{not_subject_ids} " else - subject_ids = Subject.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id }) + subject_ids = Subject.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id }).pluck(:id) subject_ids = subject_ids.length > 0 ? "(" + subject_ids.join(",") + ")" : "(-1)" laboratory_join = " AND subjects.id in #{subject_ids} " end