实训作业的分班设置导致当前状态与设置时间不一致

sso
cxt 5 years ago
parent 77876acff3
commit 9d61a5d8d1

@ -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"

@ -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

@ -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

Loading…
Cancel
Save