|
|
|
@ -485,7 +485,10 @@ class ExerciseController < ApplicationController
|
|
|
|
|
score2 = score + question.question_score unless question.question_score.nil?
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
get_mulscore(question, user, standard_answer)
|
|
|
|
|
arr = get_mulscore(question, user)
|
|
|
|
|
if arr.to_i == standard_answer.exercise_choice_id
|
|
|
|
|
score3 = score + question.question_score unless question.question_score.nil?
|
|
|
|
|
end
|
|
|
|
|
# ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id)
|
|
|
|
|
# arr = []
|
|
|
|
|
# ecs.each do |ec|
|
|
|
|
@ -503,19 +506,6 @@ class ExerciseController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
# 获取多选的得分
|
|
|
|
|
def get_mulscore(question, user, standard_answer)
|
|
|
|
|
ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id)
|
|
|
|
|
arr = []
|
|
|
|
|
ecs.each do |ec|
|
|
|
|
|
arr << ec.exercise_choice.choice_position
|
|
|
|
|
end
|
|
|
|
|
arr.sort
|
|
|
|
|
arr = arr.join("")
|
|
|
|
|
if arr.to_i == standard_answer.exercise_choice_id
|
|
|
|
|
score3 = score + question.question_score unless question.question_score.nil?
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# ExerciseUser记录用户是否已提交问卷有对应的记录则已提交,没有则新建一个
|
|
|
|
|
def get_exercise_user exercise_id,user_id
|
|
|
|
|