From 592e6a5dc5bb47559f319b586d05afeabaa3aa1f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 27 Dec 2019 17:51:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E7=9A=84jupyter=E5=AE=9E=E8=AE=AD=E4=B8=8D=E8=83=BD=E9=80=89?= =?UTF-8?q?=E7=94=A8=E5=88=B0=E8=AF=BE=E5=A0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 2 +- app/controllers/subjects_controller.rb | 2 +- app/models/course.rb | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 3a60dcde5..89f65c61d 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1046,7 +1046,7 @@ class HomeworkCommonsController < ApplicationController course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) # 去掉不对当前用户的单位公开的实训,已发布的实训 - stage.shixuns.where.not(shixuns: {id: none_shixun_ids}).unhidden.each do |shixun| + stage.shixuns.no_jupyter.where.not(shixuns: {id: none_shixun_ids}).unhidden.each do |shixun| homework = HomeworksService.new.create_homework shixun, @course, category, current_user @homework_ids << homework.id CreateStudentWorkJob.perform_later(homework.id) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 0009ab2a6..2c1b5a810 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -255,7 +255,7 @@ class SubjectsController < ApplicationController CourseSecondCategory.create!(name: stage.name, course_id: @course.id, category_type: "shixun_homework", course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) - stage.shixuns.where(id: params[:shixun_ids], status: 2).each do |shixun| + stage.shixuns.no_jupyter.where(id: params[:shixun_ids], status: 2).each do |shixun| homework = HomeworksService.new.create_homework shixun, @course, category, current_user homework_ids << homework.id end diff --git a/app/models/course.rb b/app/models/course.rb index 2f561bba7..b3e62bb99 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -92,6 +92,7 @@ class Course < ApplicationRecord where("name LIKE ?", "%#{keywords.split(" ").join('|')}%") unless keywords.blank? } scope :started, -> { where("start_date is null or start_date <= '#{Date.today}'") } + scope :no_jupyter, -> { where(is_jupyter: false) } # acts_as_taggable