试卷评阅页面的分数评判标准修改

dev_forum
SylorHuang 5 years ago
parent f286d83763
commit ef0953f867

@ -1040,6 +1040,7 @@ class ExercisesController < ApplicationController
@exercise_questions = @exercise_questions.order("question_number ASC")
end
# 判断问题是否已回答还是未回答
@exercise_questions = @exercise_questions.includes(:exercise_stand_answers,:exercise_answers,:exercise_shixun_answers)
if @t_user_exercise_status == 3
get_each_student_exercise(@exercise.id,@exercise_questions,@exercise_current_user_id)

@ -9,11 +9,32 @@ module ExercisesHelper
@ex_obj_array = []
exercise_obj_status.each do |q|
if q.question_type == 5
ques_score = q.exercise_shixun_answers.search_shixun_answers("user_id",user_id).pluck(:score).sum
answers_content = q.exercise_shixun_answers.search_shixun_answers("user_id",user_id)
else
ques_score = q.exercise_answers.search_answer_users("user_id",user_id).score_reviewed.pluck(:score).sum
answers_content = q.exercise_answers.includes(:exercise_choices).search_answer_users("user_id",user_id)
end
if q.question_type <= 2
if answers_content.present? #学生有回答时
answer_choice_array = []
answers_content.each do |a|
answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
end
user_answer_content = answer_choice_array.sort
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
ques_score = q.question_score
else
ques_score = 0.0
end
else
ques_score = 0.0
end
else
ques_score = answers_content.select(:score).pluck(:score).sum
end
if ques_score >= q.question_score #满分作答为正确
ques_score = q.question_score
stand_answer = 1
@ -370,7 +391,8 @@ module ExercisesHelper
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
if standard_answer.count > 0
q_score_1 = (q.question_score.to_f / standard_answer.count) #当多选答案正确时每个answer的分数均摊。
q_score_1 = q.question_score
# q_score_1 = (q.question_score.to_f / standard_answer.count) #当多选答案正确时每个answer的分数均摊。
else
q_score_1 = 0.0
end

Loading…
Cancel
Save