试卷调分的问题

dev_cs
SylorHuang 5 years ago
parent 8105df7623
commit 28c2dab8bf

@ -501,9 +501,11 @@ class ExerciseQuestionsController < ApplicationController
if ex_answers.present? #学生有回答时 取学生的答题得分否则0分
answer_choice_array = []
ex_answers.each do |a|
answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
if a.try(:exercise_choice).try(:choice_position).present?
answer_choice_array.push(a&.exercise_choice&.choice_position) #学生答案的位置
end
end
user_answer_content = answer_choice_array.sort
user_answer_content = answer_choice_array.reject(&:blank?).sort
standard_answer = @exercise_question.exercise_standard_answers.pluck(:exercise_choice_id).sort
if standard_answer.size == 1 # 老数据需要判断学生答题是否正确, 正确取原题得分否则是0分
standard_answer = standard_answer.first.to_s.split("").map(&:to_i).sort

Loading…
Cancel
Save