diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index bb37283ca..ee6cc80e0 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -907,10 +907,9 @@ class HomeworkCommonsController < ApplicationController # 创建作业分班设置:homework_group_setting create_homework_group_settings(homework) - # 选中的分班设置的发布时间改为当前时间,截止时间不为空的保持原状,为空的改为一个月后 - homework.homework_group_settings.where(course_group_id: publish_groups).update_all(publish_time: Time.now) - homework.homework_group_settings.where(course_group_id: publish_groups, end_time: nil). - update_all(end_time: params[:end_time]) + # 选中的分班设置的发布时间改为当前时间,截止时间改为传的截止时间参数 + homework.homework_group_settings.where(course_group_id: publish_groups).update_all(publish_time: Time.now, + end_time: params[:end_time]) # 发消息 tiding_group_ids = publish_groups end @@ -938,8 +937,7 @@ class HomeworkCommonsController < ApplicationController create_homework_group_settings(homework) none_publish_settings = homework.homework_group_settings.where(course_group_id: publish_groups).none_published - none_publish_settings.update_all(publish_time: Time.now) - none_publish_settings.where(end_time: nil).update_all(end_time: params[:end_time]) + none_publish_settings.update_all(publish_time: Time.now, end_time: params[:end_time]) if homework.max_group_end_time homework.end_time = homework.max_group_end_time end