|
|
@ -238,7 +238,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def update_score
|
|
|
|
def update_score
|
|
|
|
tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now
|
|
|
|
tip_exception("作业还未发布,暂不能计算成绩") if @homework.end_or_late_none_group
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
if @homework.unified_setting
|
|
|
|
if @homework.unified_setting
|
|
|
|
student_works = @homework.student_works
|
|
|
|
student_works = @homework.student_works
|
|
|
@ -258,6 +258,8 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings
|
|
|
|
HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
HomeworksService.new.update_student_eff_score @homework if (@homework.allow_late && @homework.late_time < Time.now) ||
|
|
|
|
|
|
|
|
(!@homework.allow_late && @homework.end_time < Time.now)
|
|
|
|
@homework.update_attribute('calculation_time', Time.now)
|
|
|
|
@homework.update_attribute('calculation_time', Time.now)
|
|
|
|
normal_status("更新成功")
|
|
|
|
normal_status("更新成功")
|
|
|
|
rescue Exception => e
|
|
|
|
rescue Exception => e
|
|
|
@ -606,14 +608,14 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
@homework.score_open = params[:score_open]
|
|
|
|
@homework.score_open = params[:score_open]
|
|
|
|
|
|
|
|
|
|
|
|
@homework.save!
|
|
|
|
@homework.save!
|
|
|
|
if score_change
|
|
|
|
# if score_change
|
|
|
|
@homework.student_works.has_committed.each do |student_work|
|
|
|
|
# @homework.student_works.has_committed.each do |student_work|
|
|
|
|
HomeworksService.new.set_shixun_final_score student_work
|
|
|
|
# HomeworksService.new.set_shixun_final_score student_work
|
|
|
|
end
|
|
|
|
# end
|
|
|
|
end
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
# 更新所有学生的效率分(作业允许补交且补交已截止 或者 作业不允许补交且提交已截止)
|
|
|
|
# 更新所有学生的效率分(作业允许补交且补交已截止 或者 作业不允许补交且提交已截止)
|
|
|
|
if (score_change || update_eff_score) && @homework.end_or_late
|
|
|
|
if update_eff_score && @homework.end_or_late_none_group
|
|
|
|
HomeworksService.new.update_student_eff_score HomeworkCommon.find_by(id: @homework.id)
|
|
|
|
HomeworksService.new.update_student_eff_score HomeworkCommon.find_by(id: @homework.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -1017,8 +1019,8 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
homework.save!
|
|
|
|
homework.save!
|
|
|
|
|
|
|
|
|
|
|
|
# 更新学生状态及成绩
|
|
|
|
# 更新学生状态及成绩(手动点击计算)
|
|
|
|
HomeworkPublishUpdateWorkStatusJob.perform_later(tiding_group_ids, homework.id)
|
|
|
|
# HomeworkPublishUpdateWorkStatusJob.perform_later(tiding_group_ids, homework.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
normal_status(0, "发布成功")
|
|
|
|
normal_status(0, "发布成功")
|
|
|
|
rescue Exception => e
|
|
|
|
rescue Exception => e
|
|
|
|