dev_forum
SylorHuang 6 years ago
parent b5ea3a60ca
commit 1aa5e6972e

@ -113,21 +113,6 @@ module ExercisesHelper
if ex.question_type <= Exercise::JUDGMENT #选择题和判断题
standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id).sort #标准答案的位置
right_users_count = 0 #该问题的回答正确的人数
# if ex.question_type == Exercise::MULTIPLE #多选题
# user_ids.each do |user_id|
# answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).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
# else #单选题和判断题
# user_ids.each do |user_id|
# answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).find_by(user_id:user_id)&.exercise_choice.choice_position
# if [answer_choice_array] == standard_answer
# right_users_count += 1
# end
# end
# end
user_ids.each do |user_id|
if ex.question_type == Exercise::MULTIPLE
answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).where(user_id:user_id)&.map {|s| s.exercise_choice.choice_position}.uniq
@ -135,7 +120,7 @@ module ExercisesHelper
right_users_count += 1
end
else
answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).find_by(user_id:user_id)&.exercise_choice.choice_position
answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).find_by(user_id:user_id)&.exercise_choice&.choice_position
if [answer_choice_array] == standard_answer
right_users_count += 1
end

Loading…
Cancel
Save