|
|
|
@ -357,6 +357,36 @@ class ExerciseQuestionsController < ApplicationController
|
|
|
|
|
#当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数.
|
|
|
|
|
|
|
|
|
|
if standard_answer_change && @exercise.exercise_status >= Exercise::PUBLISHED
|
|
|
|
|
# ex_users_committed = @exercise.exercise_users.exercise_user_committed
|
|
|
|
|
# if ex_users_committed.size > 0
|
|
|
|
|
# ex_users_committed.each do |ex_user|
|
|
|
|
|
# update_objective_score = update_single_score(@exercise_question,ex_user.user_id,standard_answer)
|
|
|
|
|
# if update_objective_score != 0
|
|
|
|
|
# objective_score = ex_user.objective_score
|
|
|
|
|
# new_objective_score = objective_score + update_objective_score
|
|
|
|
|
# total_score = ex_user.score + update_objective_score
|
|
|
|
|
# total_score = total_score < 0.0 ? 0.0 : total_score
|
|
|
|
|
# ex_user.update_attributes(objective_score:new_objective_score,score:total_score)
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
normal_status(3,"修改了标准答案\n是否重新计算学生答题的成绩?")
|
|
|
|
|
else
|
|
|
|
|
normal_status(0,"试卷更新成功!")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
|
tip_exception("页面调用失败!")
|
|
|
|
|
raise ActiveRecord::Rollback
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def update_scores
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
begin
|
|
|
|
|
standard_answer = params[:standard_answers]
|
|
|
|
|
ex_users_committed = @exercise.exercise_users.exercise_user_committed
|
|
|
|
|
if ex_users_committed.size > 0
|
|
|
|
|
ex_users_committed.each do |ex_user|
|
|
|
|
@ -370,15 +400,10 @@ class ExerciseQuestionsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
normal_status(0,"试卷更新成功,因标准答案修改,需重新计算学生成绩!")
|
|
|
|
|
else
|
|
|
|
|
normal_status(0,"试卷更新成功!")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
normal_status(0,"学生成绩更新成功")
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
|
tip_exception("页面调用失败!")
|
|
|
|
|
raise ActiveRecord::Rollback
|
|
|
|
|
tip_exception("答案删除失败!")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|