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