diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index cf78cbc05..04189af6a 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -467,7 +467,7 @@ class ExerciseController < ApplicationController standard_answer = get_user_standard_answer(question, user) # 问答题有多个答案 if question.question_type == 3 - if standard_answer.exercise_choice_id.include?(answer.exercise_choice_id) + if standard_answer.include?(answer.exercise_choice_id) score += question.question_score unless question.question_score.empty? end else @@ -510,7 +510,14 @@ class ExerciseController < ApplicationController # 获取问题的标准答案 def get_user_standard_answer(question,user) - standard_answer = question.exercise_standard_answers + if question.question_type == 3 + standard_answer =[] + question.exercise_standard_answers.each do |answer| + standard_answer << answer.answer_text + end + else + standard_answer = question.exercise_standard_answers + end standard_answer end diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index ec7421533..d67f4443f 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -28,6 +28,7 @@ module ExerciseHelper answer.join("") end + # def fill_standart_answer(params, standart_answer) params.each do |param| standart_answer.answer_text = param.value