|
|
@ -118,7 +118,7 @@ module ExercisesHelper
|
|
|
|
if ex.question_type == Exercise::MULTIPLE #多选题
|
|
|
|
if ex.question_type == Exercise::MULTIPLE #多选题
|
|
|
|
right_user_ids = user_ids
|
|
|
|
right_user_ids = user_ids
|
|
|
|
standard_answer.each do |choice_position|
|
|
|
|
standard_answer.each do |choice_position|
|
|
|
|
standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == choice_position}.first.id
|
|
|
|
standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == choice_position}.first&.id
|
|
|
|
right_user_ids = right_user_ids & effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.pluck(:user_id)
|
|
|
|
right_user_ids = right_user_ids & effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.pluck(:user_id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
right_users_count = right_user_ids.size
|
|
|
|
right_users_count = right_user_ids.size
|
|
|
@ -130,7 +130,7 @@ module ExercisesHelper
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
else #单选题和判断题
|
|
|
|
else #单选题和判断题
|
|
|
|
standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == standard_answer.first}.first.id
|
|
|
|
standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == standard_answer.first}.first&.id
|
|
|
|
right_users_count = effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.size
|
|
|
|
right_users_count = effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.size
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|