解决参数为空的bug
This commit is contained in:
parent
7dc16775dc
commit
81e2827277
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue