|
|
@ -213,8 +213,19 @@ class ExerciseController < ApplicationController
|
|
|
|
if params[:exercise_choice]
|
|
|
|
if params[:exercise_choice]
|
|
|
|
if @exercise_question.question_type == 3
|
|
|
|
if @exercise_question.question_type == 3
|
|
|
|
for i in 1..params[:exercise_choice].count
|
|
|
|
for i in 1..params[:exercise_choice].count
|
|
|
|
question_standart = @exercise_question.exercise_standard_answers.find_by_id params[:exercise_choice].keys[i]
|
|
|
|
# 找到对应的标准答案
|
|
|
|
answer_standart = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1]
|
|
|
|
question_standart = @exercise_question.exercise_standard_answers.find_by_id params[:exercise_choice].keys[i-1]
|
|
|
|
|
|
|
|
# 标准答案值
|
|
|
|
|
|
|
|
answer_standart = (params[:exercise_choice].values[i-1].nil? || params[:exercise_choice].values[i-1].empty?) ? l(:label_new_answer) : params[:exercise_choice].values[i-1]
|
|
|
|
|
|
|
|
if question_standart
|
|
|
|
|
|
|
|
question_standart.answer_text = answer_standart
|
|
|
|
|
|
|
|
question_standart.save
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
standart_answer_option = {
|
|
|
|
|
|
|
|
:answer_text => question_standart
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@exercise_question.exercise_standard_answers.new standart_answer_option
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
answer_standart = @exercise_question.exercise_standard_answers.first
|
|
|
|
answer_standart = @exercise_question.exercise_standard_answers.first
|
|
|
|