From 27d67477c6fb4771850d64584349b5686a5da524 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 17 Jul 2019 09:33:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E5=8F=91=E5=B8=83=E7=9A=84?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index ccadba89c..d1568a5e0 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -522,7 +522,7 @@ class HomeworkCommonsController < ApplicationController tip_exception("截止时间不能早于等于当前时间") if setting[:end_time] <= strf_time(Time.now) tip_exception("截止时间不能早于发布时间") if setting[:publish_time] > setting[:end_time] - tip_exception("截止时间不能早于课堂结束时间") if setting[:end_time] > strf_time(@course.end_date.end_of_day) + tip_exception("截止时间不能晚于课堂结束时间") if @course.end_date.present? && setting[:end_time] > strf_time(@course.end_date.end_of_day) group_settings.none_published.update_all(publish_time: setting[:publish_time]) group_settings.none_end.update_all(end_time: setting[:end_time]) @@ -1048,7 +1048,8 @@ class HomeworkCommonsController < ApplicationController def publish_homework tip_exception("请至少选择一个分班") if params[:group_ids].blank? && @course.course_groups.size != 0 tip_exception("缺少截止时间参数") if params[:end_time].blank? - tip_exception("截止时间必须晚于当前时间") if params[:end_time] <= strf_time(Time.now) + tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now) + tip_exception("截止时间不能晚于课堂结束时间") if @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) homeworks = @course.homework_commons.where(id: params[:homework_ids]) homeworks = homeworks.includes(:homework_group_settings, :homework_detail_manual) @@ -1067,6 +1068,7 @@ class HomeworkCommonsController < ApplicationController if @course.course_groups.where(id: publish_groups).size == @course.course_groups.size homework.homework_group_settings.destroy_all homework.unified_setting = true + homework.end_time = params[:end_time] else homework.unified_setting = false # 创建作业分班设置:homework_group_setting @@ -1085,7 +1087,7 @@ class HomeworkCommonsController < ApplicationController homework.publish_time = Time.now - # 截止时间不为空的保持原状,为空的改为一个月后, 非统一设置的更新为最大分班截止时间 + # 截止时间的处理 if homework.end_time.nil? homework.end_time = params[:end_time] elsif homework.max_group_end_time