From 72a511390fcc066636279380ffd6e5fbf4b23258 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 13 Nov 2019 20:33:31 +0800 Subject: [PATCH] s --- app/helpers/exercises_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index db929b94d..b0e356666 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -167,10 +167,10 @@ module ExercisesHelper effictive_users_ids = effictive_users.where("answer_text is not null and answer_text !=''").pluck(:user_id).uniq effictive_users_count = effictive_users_ids.size user_wrong_count = 0 - user_ids.each do |s| + effictive_users_ids.each do |s| user_score = effictive_users.where(user_id: s).pluck(:score).sum - unless user_score.to_f >= ex&.question_score.to_f - user_wrong_count + 1 + if user_score.to_f < ex&.question_score.to_f + user_wrong_count = user_wrong_count + 1 end end # user_wrong_ids = effictive_users.where()