|
|
|
@ -84,7 +84,7 @@ module ExercisesHelper
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#试卷的统计结果页面计算各题的
|
|
|
|
|
def exercise_commit_result(questions,user_ids)
|
|
|
|
|
def exercise_commit_result(questions,user_ids,commit_users)
|
|
|
|
|
question_infos = []
|
|
|
|
|
percent = 0.0
|
|
|
|
|
questions.each do |ex|
|
|
|
|
@ -115,9 +115,9 @@ module ExercisesHelper
|
|
|
|
|
right_users_count = 0 #该问题的回答正确的人数
|
|
|
|
|
|
|
|
|
|
#计算每个问题的答案人数
|
|
|
|
|
effictive_users.transaction do
|
|
|
|
|
user_ids.each do |user_id|
|
|
|
|
|
answer_choice_array = effictive_users.where(user_id:user_id)&.map {|s| s.exercise_choice.choice_position}.uniq
|
|
|
|
|
commit_users.transaction do
|
|
|
|
|
commit_users.each do |user|
|
|
|
|
|
answer_choice_array = effictive_users.select(:user_id).where(user_id:user.user_id)&.map {|s| s.exercise_choice.choice_position}.uniq
|
|
|
|
|
if answer_choice_array.sort == standard_answer
|
|
|
|
|
right_users_count += 1
|
|
|
|
|
end
|
|
|
|
|