|
|
@ -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)
|
|
|
|
right_user_ids = right_user_ids & effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.pluck(:user_id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
right_users_count = right_user_ids.size
|
|
|
|
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 #单选题和判断题
|
|
|
|
else #单选题和判断题
|
|
|
|
standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == standard_answer.first}.first&.id
|
|
|
|
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_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
|
|
|
|
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|
|
|
|
|
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_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text
|
|
|
|
null_stand_text = null_standard_answer.pluck(:answer_text)
|
|
|
|
null_stand_text = null_standard_answer.pluck(:answer_text)
|
|
|
|
standard_answer_count = 0
|
|
|
|
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
|
|
|
|
all_user_count = 0
|
|
|
|
null_stand_choice.each_with_index do |s,index|
|
|
|
|
null_stand_choice.each_with_index do |s,index|
|
|
|
|
user_count = 0
|
|
|
|
user_count = 0
|
|
|
|