|
|
|
@ -115,12 +115,14 @@ module ExercisesHelper
|
|
|
|
|
right_users_count = 0 #该问题的回答正确的人数
|
|
|
|
|
|
|
|
|
|
#计算每个问题的答案人数
|
|
|
|
|
effictive_users.transaction do
|
|
|
|
|
user_ids.each do |user_id|
|
|
|
|
|
answer_choice_array = effictive_users.where(user_id:user_id)&.map {|s| s.exercise_choice.choice_position}.uniq
|
|
|
|
|
if answer_choice_array.sort == standard_answer
|
|
|
|
|
right_users_count += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
percent = effictive_users_count > 0 ? (right_users_count / effictive_users_count.to_f).round(3)*100 : 0.0
|
|
|
|
|
ex.exercise_choices.each do |c|
|
|
|
|
|
right_answer = standard_answer.include?(c.choice_position) #选项的标准答案为选项的位置
|
|
|
|
|