|
|
|
@ -116,12 +116,8 @@ module ExercisesHelper
|
|
|
|
|
|
|
|
|
|
#计算每个问题的答案人数
|
|
|
|
|
user_ids.each do |user_id|
|
|
|
|
|
user_an_choice = ex_answers.where(user_id:user_id)
|
|
|
|
|
answer_choice_array = []
|
|
|
|
|
user_an_choice.each do |a|
|
|
|
|
|
answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
|
|
|
|
|
end
|
|
|
|
|
if answer_choice_array == standard_answer
|
|
|
|
|
answer_choice_array = effictive_users.where(user_id:user_id)&.map {|s| s.exercise_choice.choice_position}.uniq
|
|
|
|
|
if answer_choice_array.sort == standard_answer
|
|
|
|
|
right_users_count += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -129,7 +125,7 @@ module ExercisesHelper
|
|
|
|
|
ex.exercise_choices.each do |c|
|
|
|
|
|
right_answer = standard_answer.include?(c.choice_position) #选项的标准答案为选项的位置
|
|
|
|
|
answer_this_choice = effictive_users.search_exercise_answer("exercise_choice_id",c.id)
|
|
|
|
|
answer_users_count = answer_this_choice.count
|
|
|
|
|
answer_users_count = answer_this_choice.size
|
|
|
|
|
if effictive_users_count == 0
|
|
|
|
|
answer_percent = 0.0
|
|
|
|
|
else
|
|
|
|
@ -170,7 +166,6 @@ module ExercisesHelper
|
|
|
|
|
else
|
|
|
|
|
answer_percent = (user_count / effictive_users_count.to_f ).round(3)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
answer_option = {
|
|
|
|
|
:choice_position => index+1,
|
|
|
|
|
:choice_text => s_choice_text,
|
|
|
|
@ -200,9 +195,9 @@ module ExercisesHelper
|
|
|
|
|
question_answer_infos.push(wrong_answer_position)
|
|
|
|
|
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 #部分分数人数
|
|
|
|
|
zero_scores = effictive_users.search_exercise_answer("score",0.0).count #包含为0分的,及未评阅的
|
|
|
|
|
full_scores = effictive_users.search_exercise_answer("score",ex_score).size #满分人数
|
|
|
|
|
no_full_scores = effictive_users.exercise_no_full_scores(ex_score).size #部分分数人数
|
|
|
|
|
zero_scores = effictive_users.search_exercise_answer("score",0.0).size #包含为0分的,及未评阅的
|
|
|
|
|
un_review_scores = effictive_users_count - full_scores - no_full_scores - zero_scores #未评阅数
|
|
|
|
|
if un_review_scores < 0
|
|
|
|
|
un_review_scores = 0
|
|
|
|
@ -415,7 +410,7 @@ module ExercisesHelper
|
|
|
|
|
user_answer_content = answer_choice_array.sort
|
|
|
|
|
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
|
|
|
|
|
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
|
|
|
|
|
if standard_answer.count > 0
|
|
|
|
|
if standard_answer.size > 0
|
|
|
|
|
q_score_1 = q.question_score
|
|
|
|
|
# q_score_1 = (q.question_score.to_f / standard_answer.count) #当多选答案正确时,每个answer的分数均摊。
|
|
|
|
|
else
|
|
|
|
|