|
|
|
@ -115,13 +115,14 @@ module ExercisesHelper
|
|
|
|
|
right_users_count = 0 #该问题的回答正确的人数
|
|
|
|
|
|
|
|
|
|
#计算每个问题的答案人数
|
|
|
|
|
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
|
|
|
|
|
percent = effictive_users_count > 0 ? (right_users_count / effictive_users_count.to_f).round(3)*100 : 0.0
|
|
|
|
|
# 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
|
|
|
|
|
# percent = effictive_users_count > 0 ? (right_users_count / effictive_users_count.to_f).round(3)*100 : 0.0
|
|
|
|
|
percent = 0.0
|
|
|
|
|
ex.exercise_choices.each do |c|
|
|
|
|
|
right_answer = standard_answer.include?(c.choice_position) #选项的标准答案为选项的位置
|
|
|
|
|
answer_this_choice = effictive_users.search_exercise_answer("exercise_choice_id",c.id)
|
|
|
|
|