|
|
|
@ -89,7 +89,7 @@ module ExercisesHelper
|
|
|
|
|
questions.each do |ex|
|
|
|
|
|
ex_total_score = user_ids.count * ex&.question_score #该试卷的已回答的总分
|
|
|
|
|
ex_answers = ex.exercise_answers
|
|
|
|
|
if ex.question_type != 5
|
|
|
|
|
if ex.question_type != Exercise::PRACTICAL
|
|
|
|
|
ques_title = ex.question_title
|
|
|
|
|
ques_less_title = nil
|
|
|
|
|
effictive_users = ex_answers.search_answer_users("user_id",user_ids)
|
|
|
|
@ -106,7 +106,7 @@ module ExercisesHelper
|
|
|
|
|
percent = (ex_answered_scores / ex_total_score.to_f).round(3) * 100 #正确率
|
|
|
|
|
end
|
|
|
|
|
question_answer_infos = []
|
|
|
|
|
if ex.question_type <= 2 #单选题
|
|
|
|
|
if ex.question_type <= Exercise::JUDGMENT #单选题
|
|
|
|
|
standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id) #标准答案的位置
|
|
|
|
|
ex.exercise_choices.each do |c|
|
|
|
|
|
right_answer = standard_answer.include?(c.choice_position) #选项的标准答案为选项的位置
|
|
|
|
@ -126,7 +126,7 @@ module ExercisesHelper
|
|
|
|
|
}
|
|
|
|
|
question_answer_infos.push(answer_option)
|
|
|
|
|
end
|
|
|
|
|
elsif ex.question_type == 3 #填空题
|
|
|
|
|
elsif ex.question_type == Exercise::COMPLETION #填空题
|
|
|
|
|
ex_ordered = ex.is_ordered
|
|
|
|
|
null_standard_answer = ex.exercise_standard_answers
|
|
|
|
|
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id)
|
|
|
|
@ -179,7 +179,7 @@ module ExercisesHelper
|
|
|
|
|
:right_answer => false
|
|
|
|
|
}
|
|
|
|
|
question_answer_infos.push(wrong_answer_position)
|
|
|
|
|
elsif ex.question_type == 4 #主观题
|
|
|
|
|
elsif ex.question_type == Exercise::SUBJECTIVE #主观题
|
|
|
|
|
ex_score = ex&.question_score
|
|
|
|
|
full_scores = effictive_users.search_exercise_answer("score",ex_score).count #满分人数
|
|
|
|
|
no_full_scores = effictive_users.exercise_no_full_scores(ex_score).count #部分分数人数
|
|
|
|
@ -208,7 +208,7 @@ module ExercisesHelper
|
|
|
|
|
}
|
|
|
|
|
question_answer_infos.push(answer_option)
|
|
|
|
|
end
|
|
|
|
|
elsif ex.question_type == 5 #实训题
|
|
|
|
|
elsif ex.question_type == Exercise::PRACTICAL #实训题
|
|
|
|
|
ex.exercise_shixun_challenges.each do |c|
|
|
|
|
|
cha_score = c&.question_score
|
|
|
|
|
cha_shixun_answer = effictive_users.search_shixun_keys("exercise_shixun_challenge_id",c.id)
|
|
|
|
|