试题更新
This commit is contained in:
parent
d7020fad1f
commit
a900c70e76
|
@ -188,15 +188,14 @@ class ExerciseController < ApplicationController
|
|||
@exercise_question = ExerciseQuestion.find params[:exercise_question]
|
||||
@exercise_question.question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title]
|
||||
@exercise_question.question_score = params[:question_score]
|
||||
################处理选项
|
||||
# 处理选项
|
||||
if params[:question_answer]
|
||||
@exercise_question.exercise_choices.each do |answer|
|
||||
answer.destroy unless params[:question_answer].keys.include? answer.id.to_s
|
||||
end
|
||||
# 界面需要判断选择题至少有一个选项
|
||||
for i in 1..@exercise_question.exercise_choices.count
|
||||
for i in 1..params[:question_answer].count
|
||||
question = @exercise_question.exercise_choices.find_by_id params[:question_answer].keys[i-1]
|
||||
# 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]
|
||||
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]
|
||||
if question
|
||||
question.exercise_choices_id = i
|
||||
question.answer_text = answer
|
||||
|
|
Loading…
Reference in New Issue