|
|
|
@ -800,8 +800,18 @@ module ExercisesHelper
|
|
|
|
|
user_score_pre = exercise_answers.select{|answer| answer.score >= 0.0}
|
|
|
|
|
if ques_type == 4 #主观题时,且没有大于0的分数时,为空
|
|
|
|
|
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : nil
|
|
|
|
|
elsif ques_type == 5 || ques_type == 3
|
|
|
|
|
elsif ques_type == 5
|
|
|
|
|
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0
|
|
|
|
|
elsif ques_type == 3 #填空题时,需小心出现9.9分
|
|
|
|
|
user_score_pluck = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0
|
|
|
|
|
if user_score_pluck > 0.0
|
|
|
|
|
if user_score_pluck.to_s.split(".").last == "9"
|
|
|
|
|
user_score = user_score_pluck.to_f + 0.1
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
user_score = user_score_pluck
|
|
|
|
|
end
|
|
|
|
|
# user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0
|
|
|
|
|
else #选择题,判断题根据第一个记录查分
|
|
|
|
|
user_score = user_score_pre.present? ? user_score_pre.first.score : 0.0
|
|
|
|
|
|
|
|
|
|