区分答案大小写
This commit is contained in:
parent
3efae6bde2
commit
de17ffa605
|
@ -146,7 +146,7 @@ class ExerciseController < ApplicationController
|
|||
if @exercise_questions.save
|
||||
standart_answer = ExerciseStandardAnswer.new
|
||||
standart_answer.exercise_question_id = @exercise_questions.id
|
||||
@exercise_questions.question_type == 3 ? standart_answer.answer_text = translate_standard_answer(params[:exercise_choice]) : standart_answer.exercise_choice_id = translate_standard_answer(params[:exercise_choice])
|
||||
@exercise_questions.question_type == 3 ? standart_answer.answer_text = translate_standard_answer(params[:exercise_choice]) : standart_answer.exercise_choice_id = sigle_selection_standard_answer(params[:exercise_choice])
|
||||
standart_answer.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -205,7 +205,6 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
#发布问卷
|
||||
def publish_excercise
|
||||
@exercise.exercise_status = 2
|
||||
|
|
|
@ -2,8 +2,19 @@
|
|||
module ExerciseHelper
|
||||
|
||||
# 单选
|
||||
def translate_standard_answer(params)
|
||||
answer = params.ord - 64
|
||||
def sigle_selection_standard_answer(params)
|
||||
size = params.ord - 64
|
||||
# 输入的为小写字母答案
|
||||
if size > 0
|
||||
answer = params.ord - 96
|
||||
else
|
||||
answer = params.ord
|
||||
end
|
||||
end
|
||||
|
||||
# 多选
|
||||
def multiselect_standard_answer(params)
|
||||
answer = params.ord
|
||||
end
|
||||
|
||||
#判断用户是否已经提交了问卷
|
||||
|
|
Loading…
Reference in New Issue