diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 84f337d8..5b03010d 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -359,8 +359,8 @@ class HomeworkCommonController < ApplicationController # homework 的记录更新 # 发布时间不为空 if params_publish_time && min_publish_time != "" - @homework.publish_time = min_publish_time - @homework.end_time = max_end_time + @homework.publish_time = min_publish_time if @homework.publish_time.nil? || @homework.publish_time > Time.now + @homework.end_time = max_end_time if @homework.end_time.nil? || @homework.end_time > Time.now # @homework.archive_time = params_archive_time if params_archive_time if @homework.publish_time < Time.now and @homework_detail_manual.comment_status == 0 @homework_detail_manual.comment_status = 1 @@ -379,10 +379,10 @@ class HomeworkCommonController < ApplicationController =end # 发布时间未设置 则按当前时间立即发布 elsif params_publish_time && min_publish_time == "" - @homework_detail_manual.comment_status = 1 - @homework.publish_time = Time.now + @homework_detail_manual.comment_status = 1 if @homework_detail_manual.comment_status == 0 + @homework.publish_time = Time.now if @homework.publish_time.nil? || @homework.publish_time > Time.now @homework.unified_setting = 1 - @homework.end_time = Time.at(((1.month.since.to_i)/3600.0).ceil * 3600) + @homework.end_time = Time.at(((1.month.since.to_i)/3600.0).ceil * 3600) if @homework.end_time.nil? || @homework.end_time > Time.now # @homework.archive_time = Time.at(((2.months.since.to_i)/3600.0).ceil * 3600) create_homework_user = 1 @@ -391,7 +391,7 @@ class HomeworkCommonController < ApplicationController end # 已发布的作业,只更新截止时间和结束时间 else - @homework.end_time = max_end_time if params_end_time + @homework.end_time = max_end_time if params_end_time && (@homework.end_time.nil? || @homework.end_time > Time.now) # @homework.archive_time = params_archive_time if params_archive_time =begin