|
|
|
@ -436,7 +436,7 @@ class ExercisesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
exercise_status = @exercise.get_exercise_status(current_user.id)
|
|
|
|
|
|
|
|
|
|
if exercise_status == 1 && (course_group_ids - [0]).count > 0 # 试卷未发布,且老师的分班大于1 ,才可以修改统一设置,否则按试卷默认的来处理
|
|
|
|
|
if exercise_status == 1 && course_group_ids.size > 0 # 试卷未发布,且老师的分班大于1 ,才可以修改统一设置,否则按试卷默认的来处理
|
|
|
|
|
unified_setting = params[:unified_setting]
|
|
|
|
|
else
|
|
|
|
|
unified_setting = @exercise.unified_setting
|
|
|
|
@ -450,7 +450,7 @@ class ExercisesController < ApplicationController
|
|
|
|
|
answer_open = params[:answer_open] ? true : false #答案是否公开
|
|
|
|
|
|
|
|
|
|
# 统一设置或者分班为0,则更新试卷,并删除试卷分组
|
|
|
|
|
if unified_setting || (course_group_ids.count == 0)
|
|
|
|
|
if unified_setting || (course_group_ids.size == 0)
|
|
|
|
|
params_publish_time = params[:publish_time].blank? ? nil : params[:publish_time].to_time
|
|
|
|
|
params_end_time = nil
|
|
|
|
|
if params[:end_time].blank?
|
|
|
|
@ -798,12 +798,13 @@ class ExercisesController < ApplicationController
|
|
|
|
|
if exercise_status == 2 #跳过已截止的或未发布的
|
|
|
|
|
g_course = params[:group_ids]
|
|
|
|
|
if g_course.present?
|
|
|
|
|
user_course_groups= @course.teacher_course_groups.get_user_groups(current_user.id)
|
|
|
|
|
if user_course_groups.present?
|
|
|
|
|
teacher_course_group_ids = user_course_groups.pluck(:course_group_id)
|
|
|
|
|
else
|
|
|
|
|
teacher_course_group_ids = @course.course_groups.pluck(:id)
|
|
|
|
|
end
|
|
|
|
|
# user_course_groups= @course.teacher_course_groups.get_user_groups(current_user.id)
|
|
|
|
|
# if user_course_groups.present?
|
|
|
|
|
# teacher_course_group_ids = user_course_groups.pluck(:course_group_id)
|
|
|
|
|
# else
|
|
|
|
|
# teacher_course_group_ids = @course.course_groups.pluck(:id)
|
|
|
|
|
# end
|
|
|
|
|
teacher_course_group_ids = @course.charge_group_ids(current_user)
|
|
|
|
|
if g_course.map(&:to_i).sort == teacher_course_group_ids.sort #开始为统一设置
|
|
|
|
|
exercise.exercise_group_settings.destroy_all
|
|
|
|
|
new_ex_status = set_exercise_status(exercise.publish_time,Time.now)
|
|
|
|
|