|
|
@ -15,11 +15,11 @@ class UpdateHomeworkPublishSettingService < ApplicationService
|
|
|
|
if params[:unified_setting] || course.course_groups_count == 0
|
|
|
|
if params[:unified_setting] || course.course_groups_count == 0
|
|
|
|
tip_exception("发布时间不能为空") if params[:publish_time].blank?
|
|
|
|
tip_exception("发布时间不能为空") if params[:publish_time].blank?
|
|
|
|
tip_exception("截止时间不能为空") if params[:end_time].blank?
|
|
|
|
tip_exception("截止时间不能为空") if params[:end_time].blank?
|
|
|
|
tip_exception("发布时间不能早于当前时间") if params[:publish_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
tip_exception("发布时间不能早于当前时间") if params[:publish_time].to_time <= Time.now
|
|
|
|
tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now
|
|
|
|
tip_exception("截止时间不能早于发布时间") if params[:publish_time] > params[:end_time]
|
|
|
|
tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= params[:end_time].to_time
|
|
|
|
tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
|
|
|
|
tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
|
|
|
|
course.end_date.present? && params[:end_time] > course.end_date.end_of_day
|
|
|
|
course.end_date.present? && params[:end_time].to_time > course.end_date.end_of_day
|
|
|
|
|
|
|
|
|
|
|
|
homework.unified_setting = 1
|
|
|
|
homework.unified_setting = 1
|
|
|
|
homework.homework_group_settings.destroy_all
|
|
|
|
homework.homework_group_settings.destroy_all
|
|
|
|