|
|
@ -16,18 +16,26 @@ module ExercisesHelper
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if q_type <= Exercise::JUDGMENT
|
|
|
|
if q_type <= Exercise::JUDGMENT
|
|
|
|
if answers_content.present? #学生有回答时
|
|
|
|
if answers_content.present? #学生有回答时,分数已经全部存到exercise_answer 表,所以可以直接取第一个值
|
|
|
|
answer_choice_array = []
|
|
|
|
ques_score = answers_content.first.score
|
|
|
|
answers_content.each do |a|
|
|
|
|
ques_score = ques_score < 0 ? 0.0 : ques_score
|
|
|
|
answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
|
|
|
|
# answer_choice_array = []
|
|
|
|
end
|
|
|
|
# answers_content.each do |a|
|
|
|
|
user_answer_content = answer_choice_array.sort
|
|
|
|
# answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
|
|
|
|
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
|
|
|
|
# end
|
|
|
|
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
|
|
|
|
# user_answer_content = answer_choice_array.sort
|
|
|
|
ques_score = q.question_score
|
|
|
|
# standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
|
|
|
|
else
|
|
|
|
# if q_type == Exercise::MULTIPLE && standard_answer.size == 1 # 老数据的问题
|
|
|
|
ques_score = 0.0
|
|
|
|
# ques_score = answers_content.first.score
|
|
|
|
end
|
|
|
|
# else
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
|
|
|
|
|
|
|
|
# ques_score = q.question_score
|
|
|
|
|
|
|
|
# else
|
|
|
|
|
|
|
|
# ques_score = 0.0
|
|
|
|
|
|
|
|
# end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ques_score = 0.0
|
|
|
|
ques_score = 0.0
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -58,7 +66,6 @@ module ExercisesHelper
|
|
|
|
exercise_sub_status.each do |s|
|
|
|
|
exercise_sub_status.each do |s|
|
|
|
|
sub_answer = s.exercise_answers.search_answer_users("user_id",user_id) #主观题只有一个回答
|
|
|
|
sub_answer = s.exercise_answers.search_answer_users("user_id",user_id) #主观题只有一个回答
|
|
|
|
if sub_answer.present? && sub_answer.first.score >= 0.0
|
|
|
|
if sub_answer.present? && sub_answer.first.score >= 0.0
|
|
|
|
|
|
|
|
|
|
|
|
if s.question_score <= sub_answer.first.score
|
|
|
|
if s.question_score <= sub_answer.first.score
|
|
|
|
stand_status = 1
|
|
|
|
stand_status = 1
|
|
|
|
else
|
|
|
|
else
|
|
|
|