From b3f3b03c461aaf291c5098179b71f876c032e3ce Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 16 Oct 2019 16:24:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=EF=BC=8C=E5=A1=AB=E7=A9=BA=E9=A2=98=E7=9A=84?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=8E=87=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 59a2d3d25..9a62e6b1d 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -143,15 +143,15 @@ module ExercisesHelper 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 - right_users_scores = right_users_count * ex&.question_score.to_f + # right_users_scores = right_users_count * ex&.question_score.to_f else #单选题和判断题 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_scores = right_users_count * ex&.question_score.to_f + # right_users_scores = right_users_count * ex&.question_score.to_f end - percent = (ex_total_score == 0.0 ? 0.0 : (right_users_scores / ex_total_score.to_f).round(3) * 100) #正确率 + # percent = (ex_total_score == 0.0 ? 0.0 : (right_users_scores / ex_total_score.to_f).round(3) * 100) #正确率 - # percent = commit_user_ids > 0 ? (right_users_count / commit_user_ids.to_f).round(3)*100 : 0.0 + percent = commit_user_ids > 0 ? (right_users_count / commit_user_ids.to_f).round(3)*100 : 0.0 #每个选项的正确率 ex_choices.each do |c| @@ -175,7 +175,7 @@ module ExercisesHelper null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text null_stand_text = null_standard_answer.pluck(:answer_text) standard_answer_count = 0 - each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.size).round(3) : 0.0 + each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0 all_user_count = 0 null_stand_choice.each_with_index do |s,index| user_count = 0