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