|
|
|
@ -500,16 +500,16 @@ class ExercisesController < ApplicationController
|
|
|
|
|
old_exercise_groups = exercise_groups_ids - total_common_group #后来传入的分班里,没有了的班级,即需要删除
|
|
|
|
|
|
|
|
|
|
params_times.each do |t|
|
|
|
|
|
tip_exception("发布时间不能为空") if t[:publish_time].blank?
|
|
|
|
|
tip_exception("截止时间不能为空") if t[:end_time].blank?
|
|
|
|
|
tip_exception("截止时间不能早于发布时间") if t[:publish_time].to_time > t[:end_time].to_time
|
|
|
|
|
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
|
|
|
|
|
@course.end_date.present? && t[:end_time].to_time > @course.end_date.end_of_day
|
|
|
|
|
|
|
|
|
|
course_id = t[:course_group_id]
|
|
|
|
|
exercise_publish_time = t[:publish_time].present? ? t[:publish_time].to_time : nil
|
|
|
|
|
exercise_end_time = nil
|
|
|
|
|
if t[:end_time].blank?
|
|
|
|
|
if exercise_publish_time.present?
|
|
|
|
|
exercise_end_time = exercise_publish_time + 30.days
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
exercise_publish_time = t[:publish_time].to_time
|
|
|
|
|
exercise_end_time = t[:end_time].to_time
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
exercise_group = exercise_groups.find_in_exercise_group("course_group_id",course_id) #判断该分班是否存在
|
|
|
|
|
if exercise_group.present? && (exercise_group.first.publish_time < Time.now) && (exercise_publish_time != exercise_group.first.publish_time)
|
|
|
|
|
error_count += 1
|
|
|
|
@ -553,7 +553,7 @@ class ExercisesController < ApplicationController
|
|
|
|
|
:end_time => exercise_end_time
|
|
|
|
|
}
|
|
|
|
|
new_exercise_group = ExerciseGroupSetting.new(exercise_group_params)
|
|
|
|
|
new_exercise_group.save
|
|
|
|
|
new_exercise_group.save!
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -602,7 +602,7 @@ class ExercisesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
|
tip_exception("提交出现错误!")
|
|
|
|
|
tip_exception(e.message)
|
|
|
|
|
raise ActiveRecord::Rollback
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -1534,7 +1534,7 @@ class ExercisesController < ApplicationController
|
|
|
|
|
ex_group_settings = @exercise.exercise_group_settings
|
|
|
|
|
if ex_group_settings.present?
|
|
|
|
|
p_time_present = ex_group_settings.publish_time_no_null.map(&:publish_time).min
|
|
|
|
|
if p_time_present < Time.now
|
|
|
|
|
if p_time_present && p_time_present < Time.now
|
|
|
|
|
normal_status(-1,"设置失败,存在已发布的分班")
|
|
|
|
|
end
|
|
|
|
|
elsif params[:publish_time].blank?
|
|
|
|
|