|
|
|
@ -113,9 +113,15 @@ module ExercisesHelper
|
|
|
|
|
if ex.question_type <= Exercise::JUDGMENT #选择题和判断题
|
|
|
|
|
standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id).sort #标准答案的位置
|
|
|
|
|
right_users_count = 0 #该问题的回答正确的人数
|
|
|
|
|
|
|
|
|
|
#计算每个问题的答案人数
|
|
|
|
|
user_ids.each do |user_id|
|
|
|
|
|
user_an_choice = effictive_users.where(user_id:user_id).pluck(:exercise_choice_id).sort
|
|
|
|
|
if user_an_choice == standard_answer
|
|
|
|
|
user_an_choice = ex_answers.where(user_id:user_id)
|
|
|
|
|
answer_choice_array = []
|
|
|
|
|
user_an_choice.each do |a|
|
|
|
|
|
answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
|
|
|
|
|
end
|
|
|
|
|
if answer_choice_array == standard_answer
|
|
|
|
|
right_users_count += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|