问卷得分统计
This commit is contained in:
parent
cb3f0d1c97
commit
db46e5e4af
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue