Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course

This commit is contained in:
cxt 2015-11-19 17:50:32 +08:00
commit 602373812f
1 changed files with 5 additions and 1 deletions

View File

@ -213,6 +213,10 @@ class ExerciseController < ApplicationController
# 更新标准答案
if params[:exercise_choice]
if @exercise_question.question_type == 3
# 删除不合理的选项
@exercise_question.exercise_standard_answers.each do |answer|
answer.destroy unless params[:exercise_choice].keys.include? answer.id.to_s
end
for i in 1..params[:exercise_choice].count
# 找到对应的标准答案
question_standart = @exercise_question.exercise_standard_answers.find_by_id params[:exercise_choice].keys[i-1]
@ -223,7 +227,7 @@ class ExerciseController < ApplicationController
question_standart.save
else
standart_answer_option = {
:answer_text => question_standart
:answer_text => answer_standart
}
@exercise_question.exercise_standard_answers.new standart_answer_option
end