From 02db1b7e142c957786085bdf7952d10d649cce2e Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 17 Nov 2015 21:13:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E6=B7=BB=E5=8A=A0=E6=A0=87?= =?UTF-8?q?=E5=87=86=E7=AD=94=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 6 +++++- app/views/exercise/_new_MC.html.erb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 4d2e266b5..8ca8ca31f 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -125,7 +125,7 @@ class ExerciseController < ApplicationController 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] question_option = { - :answer_position => i, + :exercise_choice_id => i, :answer_text => answer } @exercise_questions.exercise_answers.new question_option @@ -139,6 +139,10 @@ class ExerciseController < ApplicationController @exercise_questions.question_number = params[:quest_num].to_i + 1 end if @exercise_questions.save + standart_answer = ExerciseStandardAnswer.new + standart_answer.exercise_question_id = @exercise_questions.id + standart_answer.exercise_choice_id = params[:exercise_choice] + standart_answer.save respond_to do |format| format.js end diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb index de7e9ba31..1b82d35ce 100644 --- a/app/views/exercise/_new_MC.html.erb +++ b/app/views/exercise/_new_MC.html.erb @@ -43,7 +43,7 @@
  • - +