解决参数为空的bug

This commit is contained in:
huang 2015-11-19 21:21:02 +08:00
parent 7dc16775dc
commit 81e2827277
2 changed files with 5 additions and 3 deletions

View File

@ -449,11 +449,11 @@ class ExerciseController < ApplicationController
# 问答题有多个答案 # 问答题有多个答案
if question.question_type == 3 if question.question_type == 3
if standard_answer.exercise_choice_id.include?(answer.exercise_choice_id) 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 end
else else
if answer.exercise_choice_id == standard_answer.exercise_choice_id 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 end
end end

View File

@ -65,7 +65,9 @@ module ExerciseHelper
score = 0 score = 0
unless exercise.nil? unless exercise.nil?
exercise.exercise_questions.each do |exercise_question| 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 end
return score return score
end end