From db46e5e4afb172cd5499f1bbc3bdcfe3628b71a5 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 15:13:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E5=BE=97=E5=88=86=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 11 +++++++++-- app/helpers/exercise_helper.rb | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) 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