|
|
|
@ -438,8 +438,8 @@ module ExercisesHelper
|
|
|
|
|
end
|
|
|
|
|
if q.is_ordered
|
|
|
|
|
answers_content.each do |u|
|
|
|
|
|
i_standard_answer = standard_answer_array.where(exercise_choice_id:u.exercise_choice_id).pluck(:answer_text).reject(&:blank?).map!(&:downcase) #该选项的全部标准答案
|
|
|
|
|
if i_standard_answer.include?(u.answer_text.downcase) #该空的标准答案包含用户的答案才有分数
|
|
|
|
|
i_standard_answer = standard_answer_array.where(exercise_choice_id:u.exercise_choice_id).pluck(:answer_text).reject(&:blank?).map{|a| a.strip.downcase} #该选项的全部标准答案
|
|
|
|
|
if i_standard_answer.include?(u.answer_text.strip.downcase) #该空的标准答案包含用户的答案才有分数
|
|
|
|
|
u.update_column('score',q_score_2)
|
|
|
|
|
score2 = score2 + q_score_2
|
|
|
|
|
else
|
|
|
|
@ -448,9 +448,9 @@ module ExercisesHelper
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
st_answer_text = standard_answer_array.pluck(:answer_text).reject(&:blank?).map!(&:downcase)
|
|
|
|
|
st_answer_text = standard_answer_array.pluck(:answer_text).reject(&:blank?).map{|a| a.strip.downcase}
|
|
|
|
|
answers_content.each do |u|
|
|
|
|
|
u_answer_text = u.answer_text.downcase
|
|
|
|
|
u_answer_text = u.answer_text.strip.downcase
|
|
|
|
|
if st_answer_text.include?(u_answer_text) #只要标准答案包含用户的答案,就有分数。同时,下一次循环时,就会删除该标准答案。防止用户的相同答案获分
|
|
|
|
|
u.update_column("score",q_score_2)
|
|
|
|
|
score2 = score2 + q_score_2
|
|
|
|
@ -582,8 +582,8 @@ module ExercisesHelper
|
|
|
|
|
i_standard_answer += a[:answer_text]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
i_standard_answer = i_standard_answer.map(&:downcase)
|
|
|
|
|
if i_standard_answer.include?(u.answer_text.downcase) #该空的标准答案包含用户的答案才有分数
|
|
|
|
|
i_standard_answer = i_standard_answer.map{|a| a.strip.downcase}
|
|
|
|
|
if i_standard_answer.include?(u.answer_text.strip.downcase) #该空的标准答案包含用户的答案才有分数
|
|
|
|
|
u.update_column('score',q_score_2)
|
|
|
|
|
score1 = score1 + q_score_2
|
|
|
|
|
else
|
|
|
|
@ -592,7 +592,7 @@ module ExercisesHelper
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
st_answer_text = standard_answer.pluck(:answer_text).sum.map(&:downcase)
|
|
|
|
|
st_answer_text = standard_answer.pluck(:answer_text).sum.map{|a| a.strip.downcase}
|
|
|
|
|
answers_content.each do |u|
|
|
|
|
|
u_answer_text = u.answer_text.downcase
|
|
|
|
|
if st_answer_text.include?(u_answer_text) #只要标准答案包含用户的答案,就有分数。同时,下一次循环时,就会删除该标准答案。防止用户的相同答案获分
|
|
|
|
|