diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 22e7636c4..363e5780d 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1045,7 +1045,7 @@ class HomeworkCommonsController < ApplicationController def end_homework tip_exception("请至少选择一个分班") if params[:group_ids].blank? && @course.course_groups.size != 0 - time = Time.now.strftime("%Y-%m-%d %H:%M:%S") + time = Time.now # 已发布且未截止的作业才能立即截止 @@ -1086,7 +1086,7 @@ class HomeworkCommonsController < ApplicationController homework.end_time = time end - homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time + # homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time # 实训作业的作品需要计算是否迟交 if homework.homework_type == "practice" diff --git a/app/services/update_homework_publish_setting_service.rb b/app/services/update_homework_publish_setting_service.rb index 61902cd80..bb77a88ec 100644 --- a/app/services/update_homework_publish_setting_service.rb +++ b/app/services/update_homework_publish_setting_service.rb @@ -105,6 +105,10 @@ class UpdateHomeworkPublishSettingService < ApplicationService homework.end_time = homework.max_group_end_time end end + if homework.end_time > Time.now && homework.homework_detail_manual.try(:comment_status) > 1 + homework.homework_detail_manual.update_attributes!(comment_status: 1) + end + homework.save! HomeworkCommonPushNotifyJob.perform_later(homework.id, publish_group_ids) if send_tiding end diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake index a57b97eab..6ba4d7bba 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -66,7 +66,7 @@ namespace :homework_publishtime do .where("homework_type = 4 and end_time <= '#{Time.now}'") homework_commons.each do |homework| # homework_challenge_settings = homework.homework_challenge_settings - homework.homework_detail_manual.update_column("comment_status", 2) + # homework.homework_detail_manual.update_column("comment_status", 2) if homework.allow_late if homework.unified_setting