From bd73c88edd1a0673d75df661badce1b9eaea0280 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 19 Feb 2020 13:08:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E9=80=81=E8=87=B3=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=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 ++-- app/views/subjects/choose_course.json.jbuilder | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index bf5466b1e..efc117d6a 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -242,8 +242,8 @@ class SubjectsController < ApplicationController ## 云上实验室过滤 @courses = @courses.where(id: current_laboratory.all_courses) - @none_shixun_ids = @subject.shixuns.joins(:shixun_schools) - .where("school_id != #{current_user.user_extension.try(:school_id).to_i}").pluck(:id) + @all_shixun_ids = @subject.shixuns.where(use_scope: 0).pluck(:id) + + @subject.shixuns.joins(:shixun_schools).where("school_id = #{current_user.user_extension.try(:school_id).to_i} and use_scope = 1").pluck(:id) end def send_to_course diff --git a/app/views/subjects/choose_course.json.jbuilder b/app/views/subjects/choose_course.json.jbuilder index 2e03c5287..8dae4e3e4 100644 --- a/app/views/subjects/choose_course.json.jbuilder +++ b/app/views/subjects/choose_course.json.jbuilder @@ -7,7 +7,7 @@ end json.stages @subject.stages.includes(shixuns: [user: :user_extension]) do |stage| index = 1 json.shixuns stage.shixuns do |shixun| - if shixun.status == 2 && !shixun.is_jupyter && !@none_shixun_ids.include?(shixun.id) + if shixun.status == 2 && !shixun.is_jupyter && @all_shixun_ids.include?(shixun.id) json.shixun_id shixun.id json.id shixun.id json.identifier shixun.identifier