From efd83e4f81db45815cb373e967b2434a8512fe44 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 18 Jul 2019 17:12:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 6f30ba6c3..ace9e062e 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -118,7 +118,7 @@ module ExercisesHelper if ex.question_type == Exercise::MULTIPLE #多选题 right_user_ids = user_ids 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) end right_users_count = right_user_ids.size @@ -130,7 +130,7 @@ module ExercisesHelper # end # end 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 end