|
|
|
@ -88,11 +88,11 @@ module ExercisesHelper
|
|
|
|
|
question_infos = []
|
|
|
|
|
percent = 0.0
|
|
|
|
|
questions.each do |ex|
|
|
|
|
|
ex_total_score = user_ids.count * ex&.question_score #该试卷的已回答的总分
|
|
|
|
|
ex_answers = ex.exercise_answers.includes(:exercise_choice)
|
|
|
|
|
ex_total_score = user_ids.size * ex&.question_score #该试卷的已回答的总分
|
|
|
|
|
if ex.question_type != Exercise::PRACTICAL
|
|
|
|
|
ques_title = ex.question_title
|
|
|
|
|
ques_less_title = nil
|
|
|
|
|
ex_answers = ex.exercise_answers
|
|
|
|
|
effictive_users = ex_answers.search_answer_users("user_id",user_ids)
|
|
|
|
|
else
|
|
|
|
|
ques_title = ex.shixun.name
|
|
|
|
@ -121,12 +121,14 @@ module ExercisesHelper
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else #单选题和判断题
|
|
|
|
|
user_ids.each do |user_id|
|
|
|
|
|
answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).find_by(user_id:user_id)&.exercise_choice&.choice_position
|
|
|
|
|
if [answer_choice_array] == standard_answer
|
|
|
|
|
right_users_count += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
standard_answer_choice_id = ex.exercise_choices.find_by(choice_position: standard_answer.first)&.id
|
|
|
|
|
right_users_count = effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.size
|
|
|
|
|
# user_ids.each do |user_id|
|
|
|
|
|
# answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).find_by(user_id:user_id)&.exercise_choice&.choice_position
|
|
|
|
|
# if [answer_choice_array] == standard_answer
|
|
|
|
|
# right_users_count += 1
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
percent = effictive_users_count > 0 ? (right_users_count / effictive_users_count.to_f).round(3)*100 : 0.0
|
|
|
|
|