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