diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 33d61d203..8afd9e3d3 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -214,8 +214,9 @@ module ExercisesHelper # percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0 user_right_count = effictive_users.where("score > 0.0").pluck(:user_id).uniq - user_wrong_counts = effictive_users.where("score < 0.0 and answer_text is not null").pluck(:user_id).uniq - user_wrong_count = (user_wrong_counts - user_right_count).size + unanswer_user_count = effictive_users.where("score < 0.0 and answer_text != ''").pluck(:user_id).uniq + user_wrong_counts = effictive_users.where("score < 0.0 and answer_text is not null and answer_text != ''").pluck(:user_id).uniq + user_wrong_count = (user_wrong_counts - user_right_count - unanswer_user_count).size if effictive_users_count > 0 && user_wrong_count >= 0 wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3)