作业设置的调整

dev_haigong
cxt 6 years ago
parent d0178f1a9f
commit efcac7da3d

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

Loading…
Cancel
Save