From 81e28272774ef3f0455dce8a93757bdb66bd1a8f Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 19 Nov 2015 21:21:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8F=82=E6=95=B0=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 4 ++-- app/helpers/exercise_helper.rb | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index d13c02d27..4941e63ac 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -449,11 +449,11 @@ class ExerciseController < ApplicationController # 问答题有多个答案 if question.question_type == 3 if standard_answer.exercise_choice_id.include?(answer.exercise_choice_id) - score = score + question.question_score + score += question.question_score unless question.question_score.empty? end else if answer.exercise_choice_id == standard_answer.exercise_choice_id - score = score + question.question_score + score += question.question_score unless question.question_score.empty? end end end diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index 7f3d1862e..6cf89cdb8 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -65,7 +65,9 @@ module ExerciseHelper score = 0 unless exercise.nil? exercise.exercise_questions.each do |exercise_question| - score += exercise_question.question_score + unless exercise_question.question_score.nil? + score += exercise_question.question_score + end end return score end