From 41640c5160c488902f8dbed32596bf0657dd415e Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 13 Nov 2019 17:45:08 +0800 Subject: [PATCH 1/4] dd --- app/helpers/exercises_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 8afd9e3d3..5aed4df78 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -164,7 +164,7 @@ module ExercisesHelper question_answer_infos.push(answer_option) end elsif ex.question_type == Exercise::COMPLETION #填空题 - effictive_users_count = effictive_users.where("answer_text is not null").pluck(:user_id).uniq.size + effictive_users_count = effictive_users.where("answer_text is not null and answer_text !=''").pluck(:user_id).uniq.size ex_ordered = ex.is_ordered null_standard_answer = ex.exercise_standard_answers null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text From 5420adeed599b8ebe9889f124e4bb5140569910b Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 13 Nov 2019 17:48:07 +0800 Subject: [PATCH 2/4] cc --- app/helpers/exercises_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 5aed4df78..8406a1c00 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -214,7 +214,7 @@ 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 - unanswer_user_count = effictive_users.where("score < 0.0 and answer_text != ''").pluck(:user_id).uniq + unanswer_user_count = effictive_users.where("score < 0.0 and answer_text is null or 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 From 9286e504a13e74574305944aecf3c90c84749808 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 13 Nov 2019 18:47:07 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 8406a1c00..b23c03210 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -213,10 +213,10 @@ module ExercisesHelper percent = (ex_total_score == 0.0 ? 0.0 : (answer_user_score / ex_total_score.to_f).round(3) * 100) #正确率 # 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 - unanswer_user_count = effictive_users.where("score < 0.0 and answer_text is null or 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 + # user_right_count = effictive_users.where("score > 0.0").pluck(:user_id).uniq + # unanswer_user_count = effictive_users.where("score < 0.0 and answer_text is null or answer_text = ''").pluck(:user_id).uniq + user_wrong_count = effictive_users.where("score < 0.0 and (answer_text is null or answer_text = '')").pluck(:user_id).uniq.size + # 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) From 1f33b2531e9aa2c1a087d7c1bddadcdbca1f4763 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 13 Nov 2019 18:48:46 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E9=94=99=E8=AF=AF=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index b23c03210..6c45795ef 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -215,7 +215,7 @@ 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 # unanswer_user_count = effictive_users.where("score < 0.0 and answer_text is null or answer_text = ''").pluck(:user_id).uniq - user_wrong_count = effictive_users.where("score < 0.0 and (answer_text is null or answer_text = '')").pluck(:user_id).uniq.size + user_wrong_count = effictive_users.where("score < 0.0 and (answer_text is not null or answer_text != '')").pluck(:user_id).uniq.size # user_wrong_count = (user_wrong_counts - user_right_count - unanswer_user_count).size if effictive_users_count > 0 && user_wrong_count >= 0