|
|
|
all_question_status = []
|
|
|
|
json.left_banner_id @left_banner_id
|
|
|
|
json.left_banner_name @left_banner_name
|
|
|
|
json.exercise do
|
|
|
|
json.extract! @exercise,:id,:exercise_name,:exercise_description
|
|
|
|
json.exercise_status @t_user_exercise_status
|
|
|
|
json.left_time @user_left_time
|
|
|
|
json.user_exercise_status @user_exercise_status #当前用户的状态
|
|
|
|
json.user_name @ex_answerer.real_name
|
|
|
|
json.commit_status @exercise_user_current.present? ? @exercise_user_current.commit_status : 0 #当前用户是否提交
|
|
|
|
json.exercise_start_at @exercise_user_current.present? ? @exercise_user_current.start_at : nil
|
|
|
|
end
|
|
|
|
if @t_user_exercise_status == 3
|
|
|
|
json.user_score @exercise_user_current.score.present? ? @exercise_user_current.score.round(1).to_s : "0.0"
|
|
|
|
#试卷的全部分数
|
|
|
|
json.exercise_scores do
|
|
|
|
#试卷的客观题分数及是否错误
|
|
|
|
json.objective_scores do
|
|
|
|
json.partial! "exercises/question_scores", question_scores: @ex_obj_array #客观问题正确与否的显示
|
|
|
|
end
|
|
|
|
|
|
|
|
#试卷的主观题及是否错误
|
|
|
|
json.subjective_scores do
|
|
|
|
json.partial! "exercises/question_scores", question_scores: @ex_sub_array #主观题正确与否的显示
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#主观题及客观题的全部分数及正确与否的状态
|
|
|
|
all_question_status = @ex_obj_array + @ex_sub_array
|
|
|
|
else
|
|
|
|
json.question_status @question_status
|
|
|
|
end
|
|
|
|
|
|
|
|
json.partial! "exercises/exercise_scores"
|
|
|
|
|
|
|
|
json.exercise_questions do
|
|
|
|
json.array! @exercise_all_questions do |q|
|
|
|
|
question = q[:question]
|
|
|
|
# ques_position = q[:ques_number] #问题的序号,当问题为随机时,重新更新后的问题序号
|
|
|
|
question_info = get_exercise_question_info(question,@exercise,@exercise_user_current,@ex_answerer.id)
|
|
|
|
# json.q_position q[:ques_number] #问题的序号,当问题为随机时,重新更新后的问题序号
|
|
|
|
if @t_user_exercise_status == 3
|
|
|
|
this_answer_status = 0
|
|
|
|
user_score = nil
|
|
|
|
if all_question_status.size > 0
|
|
|
|
this_ques_status = all_question_status.detect {|f| f[:q_id] == question.id}
|
|
|
|
this_answer_status = this_ques_status[:stand_status]
|
|
|
|
user_score = this_ques_status[:user_score]
|
|
|
|
end
|
|
|
|
json.answer_status this_answer_status
|
|
|
|
json.user_score user_score
|
|
|
|
end
|
|
|
|
|
|
|
|
json.partial! "exercise_questions/exercise_questions",
|
|
|
|
question: question,
|
|
|
|
ex_answerer:@ex_answerer,
|
|
|
|
shixun_challenges: question.exercise_shixun_challenges,
|
|
|
|
user_answer: question_info[:answered_content],
|
|
|
|
choices:question.exercise_choices,
|
|
|
|
exercise_type:3,
|
|
|
|
shixun_type:question_info[:shixun_type],
|
|
|
|
ques_position: q[:ques_number],
|
|
|
|
edit_type:nil
|
|
|
|
end
|
|
|
|
end
|