|
|
|
@ -347,36 +347,20 @@ class ExerciseQuestionsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
#当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数.
|
|
|
|
|
|
|
|
|
|
# if @exercise.exercise_status == 2
|
|
|
|
|
# ex_users_committed = @exercise.exercise_users.exercise_user_committed
|
|
|
|
|
# if ex_users_committed.size > 0
|
|
|
|
|
# ex_users_committed.each do |ex_user|
|
|
|
|
|
# user = ex_user.user
|
|
|
|
|
# objective_score = calculate_student_score(@exercise,user)[:total_score]
|
|
|
|
|
# subjective_score = ex_user.subjective_score
|
|
|
|
|
# total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
|
|
|
|
|
# total_score = objective_score + total_score_subjective_score
|
|
|
|
|
# ex_user.update_attributes(objective_score:objective_score,score:total_score)
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
ex_users_committed = @exercise.exercise_users.exercise_user_committed
|
|
|
|
|
if ex_users_committed.size > 0
|
|
|
|
|
ex_users_committed.each do |ex_user|
|
|
|
|
|
user = ex_user.user
|
|
|
|
|
objective_score = calculate_student_score(@exercise,user)[:total_score]
|
|
|
|
|
subjective_score = ex_user.subjective_score
|
|
|
|
|
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
|
|
|
|
|
total_score = objective_score + total_score_subjective_score
|
|
|
|
|
ex_user.update_attributes(objective_score:objective_score,score:total_score)
|
|
|
|
|
if @exercise.exercise_status == 2
|
|
|
|
|
ex_users_committed = @exercise.exercise_users.exercise_user_committed
|
|
|
|
|
if ex_users_committed.size > 0
|
|
|
|
|
ex_users_committed.each do |ex_user|
|
|
|
|
|
user = ex_user.user
|
|
|
|
|
objective_score = calculate_student_score(@exercise,user)[:total_score]
|
|
|
|
|
subjective_score = ex_user.subjective_score
|
|
|
|
|
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
|
|
|
|
|
total_score = objective_score + total_score_subjective_score
|
|
|
|
|
ex_user.update_attributes(objective_score:objective_score,score:total_score)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if @exercise_question.save
|
|
|
|
|
normal_status(0,"试卷更新成功!")
|
|
|
|
|
else
|
|
|
|
|
normal_status(-1,"试卷更新失败!")
|
|
|
|
|
end
|
|
|
|
|
normal_status(0,"试卷更新成功!")
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
|
tip_exception("页面调用失败!")
|
|
|
|
|