dev_forum
SylorHuang 5 years ago
parent 58259feb48
commit 68637a2464

@ -630,14 +630,16 @@ module ExercisesHelper
user_score = nil
shixun_type = 0
question_comment = []
if q.question_type == 5
if ques_type == 5
exercise_answers = q.exercise_shixun_answers.search_shixun_answers("user_id",ex_answerer_id)
else
exercise_answers = q.exercise_answers.search_exercise_answer("user_id",ex_answerer_id) #试卷用户的回答
end
if student_status == 2 #当前为老师,或为学生且已提交
user_score = exercise_answers.score_reviewed.pluck(:score).sum
user_score_pre = exercise_answers.score_reviewed.pluck(:score).sum
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : nil
end
if user_score.present? && (user_score > q.question_score)
user_score = q.question_score
end
@ -667,7 +669,7 @@ module ExercisesHelper
question_comment = q.exercise_answer_comments.search_answer_comments("exercise_answer_id",q_answer_id)
end
{
"user_score": user_score.present? ? user_score.round(1) : nil,
"user_score": (user_score.present? ? user_score.round(1).to_s : nil),
"answered_content":answered_content,
"shixun_type":shixun_type,
"question_comment":question_comment

@ -47,14 +47,13 @@ end
json.exercise_questions do
json.array! exercise_questions do |q|
user_ques_answers = user_question_answers(q,ex_answerer.id,student_status,is_teacher_or,exercise_status,q.question_type,ex_type)
user_ques_comments = user_ques_answers[:question_comment]
if all_question_status.size > 0
this_ques_status = all_question_status.detect {|f| f[:q_id] == q.id}
json.answer_status this_ques_status[:stand_status]
end
json.user_score user_ques_answers[:user_score].present? ? user_ques_answers[:user_score].to_s : nil
json.user_score user_ques_answers[:user_score]
json.partial! "exercise_questions/exercise_questions",
question: q,
ex_answerer: ex_answerer,

Loading…
Cancel
Save