|
|
@ -255,8 +255,8 @@ class ExerciseQuestionsController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elsif @exercise_question.question_type == Exercise::COMPLETION #填空题
|
|
|
|
elsif @exercise_question.question_type == Exercise::COMPLETION #填空题
|
|
|
|
old_ex_answer = @exercise_question.exercise_standard_answers #当前问题的全部标准答案
|
|
|
|
old_ex_answer = @exercise_question.exercise_standard_answers #当前问题的全部标准答案
|
|
|
|
old_ex_answer_choice_texts = old_ex_answer.pluck(:answer_text).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.uniq.sort
|
|
|
|
new_ex_answer_choice_texts = standard_answer.pluck(:answer_text).sum.sort
|
|
|
|
if old_ex_answer_choice_texts != new_ex_answer_choice_texts #填空题标准答案有更改时,才会更新标准答案
|
|
|
|
if old_ex_answer_choice_texts != new_ex_answer_choice_texts #填空题标准答案有更改时,才会更新标准答案
|
|
|
|
new_ex_answer_choice_ids = standard_answer.map {|a| a[:choice_id]}.uniq #新传入的答案数组序号
|
|
|
|
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 #全部的答案数组序号
|
|
|
|
old_ex_answer_choice_ids = old_ex_answer.pluck(:exercise_choice_id).uniq #全部的答案数组序号
|
|
|
@ -680,8 +680,9 @@ class ExerciseQuestionsController < ApplicationController
|
|
|
|
normal_status(-1,"已发布/已截止,不允许增删答案!")
|
|
|
|
normal_status(-1,"已发布/已截止,不允许增删答案!")
|
|
|
|
elsif standard_answer.present?
|
|
|
|
elsif standard_answer.present?
|
|
|
|
if @exercise_question.question_type == Exercise::COMPLETION
|
|
|
|
if @exercise_question.question_type == Exercise::COMPLETION
|
|
|
|
exercise_answers_text = standard_answer.map{|a| a[:answer_text]}.sum.uniq
|
|
|
|
# exercise_answers_text = standard_answer.map{|a| a[:answer_text]}.sum.uniq
|
|
|
|
unless (standard_answer.count == exercise_choice_ids.count) && (standard_answers_text.count == exercise_answers_text.count)
|
|
|
|
# unless (standard_answer.count == exercise_choice_ids.count) && (standard_answers_text.count == exercise_answers_text.count)
|
|
|
|
|
|
|
|
unless standard_answer.count == exercise_choice_ids.count
|
|
|
|
normal_status(-1,"已发布/已截止,不允许增删标准答案!")
|
|
|
|
normal_status(-1,"已发布/已截止,不允许增删标准答案!")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elsif @exercise_question.question_type == Exercise::SUBJECTIVE
|
|
|
|
elsif @exercise_question.question_type == Exercise::SUBJECTIVE
|
|
|
|