|
|
|
@ -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
|
|
|
|
@ -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 != ''").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 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
|
|
|
|
|
wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3)
|
|
|
|
|