|
|
|
@ -775,22 +775,24 @@ module ExercisesHelper
|
|
|
|
|
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : nil
|
|
|
|
|
elsif ques_type == 5 || ques_type == 3
|
|
|
|
|
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0
|
|
|
|
|
else
|
|
|
|
|
if exercise_answers.present? #判断题和选择题时,
|
|
|
|
|
answer_choice_array = []
|
|
|
|
|
exercise_answers.each do |a|
|
|
|
|
|
answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
|
|
|
|
|
end
|
|
|
|
|
user_answer_content = answer_choice_array.sort
|
|
|
|
|
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
|
|
|
|
|
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
|
|
|
|
|
user_score = q.question_score
|
|
|
|
|
else
|
|
|
|
|
user_score = 0.0
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
user_score = 0.0
|
|
|
|
|
end
|
|
|
|
|
else #选择题,判断题根据第一个记录查分
|
|
|
|
|
user_score = user_score_pre.present? ? user_score_pre.first.score : 0.0
|
|
|
|
|
|
|
|
|
|
# if exercise_answers.present? #判断题和选择题时,
|
|
|
|
|
# answer_choice_array = []
|
|
|
|
|
# exercise_answers.each do |a|
|
|
|
|
|
# answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
|
|
|
|
|
# end
|
|
|
|
|
# user_answer_content = answer_choice_array.sort
|
|
|
|
|
# standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
|
|
|
|
|
# if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
|
|
|
|
|
# user_score = q.question_score
|
|
|
|
|
# else
|
|
|
|
|
# user_score = 0.0
|
|
|
|
|
# end
|
|
|
|
|
# else
|
|
|
|
|
# user_score = 0.0
|
|
|
|
|
# end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|