|
|
|
@ -136,6 +136,7 @@ class ExerciseController < ApplicationController
|
|
|
|
|
:question_score => params[:question_score]
|
|
|
|
|
}
|
|
|
|
|
@exercise_questions = @exercise.exercise_questions.new option
|
|
|
|
|
# params[:question_answer] 题目选项
|
|
|
|
|
if params[:question_answer]
|
|
|
|
|
for i in 1..params[:question_answer].count
|
|
|
|
|
answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1]
|
|
|
|
@ -154,6 +155,7 @@ class ExerciseController < ApplicationController
|
|
|
|
|
@exercise_questions.question_number = params[:quest_num].to_i + 1
|
|
|
|
|
end
|
|
|
|
|
if @exercise_questions.save
|
|
|
|
|
# params[:exercise_choice] 标准答案参数
|
|
|
|
|
standart_answer = ExerciseStandardAnswer.new
|
|
|
|
|
standart_answer.exercise_question_id = @exercise_questions.id
|
|
|
|
|
if @exercise_questions.question_type == 1
|
|
|
|
@ -161,7 +163,7 @@ class ExerciseController < ApplicationController
|
|
|
|
|
elsif @exercise_questions.question_type == 2
|
|
|
|
|
standart_answer.exercise_choice_id = multiselect_standard_answer(params[:exercise_choice])
|
|
|
|
|
else
|
|
|
|
|
standart_answer.answer_text = sigle_selection_standard_answer(params[:exercise_choice])
|
|
|
|
|
standart_answer.answer_text = fill_standart_answer(params[:exercise_choice])
|
|
|
|
|
end
|
|
|
|
|
standart_answer.save
|
|
|
|
|
respond_to do |format|
|
|
|
|
|