diff --git a/app/controllers/exercise_questions_controller.rb b/app/controllers/exercise_questions_controller.rb index dccdae809..8c3a04f61 100644 --- a/app/controllers/exercise_questions_controller.rb +++ b/app/controllers/exercise_questions_controller.rb @@ -255,8 +255,8 @@ class ExerciseQuestionsController < ApplicationController end elsif @exercise_question.question_type == Exercise::COMPLETION #填空题 old_ex_answer = @exercise_question.exercise_standard_answers #当前问题的全部标准答案 - old_ex_answer_choice_texts = old_ex_answer.pluck(:answer_text).uniq.sort - new_ex_answer_choice_texts = standard_answer.pluck(:answer_text).sum.uniq.sort + old_ex_answer_choice_texts = old_ex_answer.pluck(:answer_text).sort + new_ex_answer_choice_texts = standard_answer.pluck(:answer_text).sum.sort if old_ex_answer_choice_texts != new_ex_answer_choice_texts #填空题标准答案有更改时,才会更新标准答案 new_ex_answer_choice_ids = standard_answer.map {|a| a[:choice_id]}.uniq #新传入的答案数组序号 old_ex_answer_choice_ids = old_ex_answer.pluck(:exercise_choice_id).uniq #全部的答案数组序号