<%= @exercise.try(:exercise_name) %>

<%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description)&.html_safe %>

<% if @exercise_single_ques_count > 0 %> 单选题<%= @exercise_single_ques_count %>题, 共<%= @exercise_single_ques_scores %> <% end %> <% if @exercise_double_ques_count > 0 %> 多选题<%= @exercise_double_ques_count %>题, 共<%= @exercise_double_ques_scores %> <% end %> <% if @exercise_ques_judge_count > 0 %> 判断题<%= @exercise_ques_judge_count %>题, 共<%= @exercise_ques_judge_scores %> <% end %> <% if @exercise_ques_null_count > 0 %> 填空题<%= @exercise_ques_null_count %>题, 共<%= @exercise_ques_null_scores %> <% end %> <% if @exercise_ques_main_count > 0 %> 主观题<%= @exercise_ques_main_count %>题, 共<%= @exercise_ques_main_scores %> <% end %> <% if @exercise_ques_shixun_count > 0 %> 实训题<%= @exercise_ques_shixun_count %>题, 共<%= @exercise_ques_shixun_scores %> <% end %> <% if @exercise_ques_count > 0 %> <%= @exercise_ques_scores %> 合计<%= @exercise_ques_count %> <% end %>

<% if @ex_obj_array.size > 0 %>

客观题 正确 错误 部分得分 总分:<%= @exercise_user&.score %>分

<% @ex_obj_array.each do |s| %> <% if s[:stand_status] == 1 %>
<%= s[:q_position] %>
<% elsif s[:stand_status] == 0 %>
<%= s[:q_position] %>
<% else %>
<%= s[:q_position] %>
<% end %> <% end %>
<% end %> <% if @ex_sub_array.size > 0 %>

主观题 已评 未评 开始答题时间:<%= @exercise_user.start_at.present? ? @exercise_user.start_at.strftime("%Y-%m-%d %H:%M") : "--" %>

<% @ex_sub_array.each do |s| %> <% if s[:stand_status] == 0 %>
<%= s[:q_position] %>
<% else %>
<%= s[:q_position] %>
<% end %> <% end %>
<% end %>
<% @exercise_questions.each do |q| %> <% q_type = q.question_type %> <% games =( q_type == 5 ? @ex_user_user.games.ch_games(q.exercise_shixun_challenges.pluck(:challenge_id)) : nil) %> <% user_answer = (q_type == 5 ? q.exercise_shixun_answers.where(user_id: @ex_user_user.id) : q.exercise_answers.where(user_id: @ex_user_user.id)) %> <% this_ques_status = @ex_obj_array.detect{|f| f[:q_id] == q.id} %> <% main_ques_status = @ex_sub_array.detect{|f| f[:q_id] == q.id} %> <% ques_comment = q.exercise_answer_comments.where("exercise_answer_id",user_answer.first&.id) %>
<%= q.question_number %>、  <%= q.question_type_name %> (<%= q&.question_score %>分) <% if q_type == 5 %> <% if this_ques_status.present? && this_ques_status[:stand_status] == 1 %> <%= this_ques_status[:user_score] %>分 <% elsif this_ques_status.present? && this_ques_status[:stand_status] == 2 %> <%= this_ques_status[:user_score] %>分 <% else %> 0.0分 <% end %> <% elsif q_type == 4 %> <% if main_ques_status.present? && main_ques_status[:stand_status] == 1 %> <%= main_ques_status[:user_score] %>分 <% elsif main_ques_status.present? && main_ques_status[:stand_status] == 2 %> <%= main_ques_status[:user_score] %>分 <% else %> 未批 <% end %> <% else %> <% if this_ques_status.present? && this_ques_status[:stand_status] == 1 %> <%= this_ques_status[:user_score] %>分 <% elsif this_ques_status.present? && this_ques_status[:stand_status] == 2 %> <%= this_ques_status[:user_score] %>分 <% else %> 0.0分 <% end %> <% end %>
<% if q.question_type == 5 %> <%= to_markdown(q.shixun_name,@request_url) %>
<%= to_markdown(q.question_title,@request_url) %>
<% else %> <%= to_markdown(q.question_title,@request_url) %> <% end %>
<% if q_type == 0 %> <% q.exercise_choices.each do |s| %> <% check_answer = (user_answer.present? && (s.id == user_answer.first.exercise_choice_id)) ? "choose-answer" : '' %>
<%= to_markdown(s.choice_text,@request_url) %>
<% end %> <% elsif q_type == 1 %> <% q.exercise_choices.each do |s| %> <% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %>
<% if check_answer %> <% else %> <% end %> <%= to_markdown(s.choice_text,@request_url) %>
<% end %> <% elsif q_type == 2 %>
<% q.exercise_choices.each do |s| %> <% if user_answer.present? && (s.id == user_answer.first.exercise_choice_id) %> <% check_answer = 'choose-answer' %> <% else %> <% check_answer = '' %> <% end %> <%= s.choice_text %> <% end %>
<% elsif q_type == 3 %> <% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %> <% st_counts.each_with_index do |s,index| %> <% if user_answer.present? && user_answer.where(exercise_choice_id:s).present? %> <% check_answer = user_answer.where(exercise_choice_id:s).first.answer_text %> <% else %> <% check_answer = "--" %> <% end %>
答案(填空<%= index+1 %>):
<%= to_markdown(check_answer,@request_url) %>
<% end %> <% elsif q_type == 4 %> <% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %>
<%= to_markdown(check_answer,@request_url) %>
<% else %>

阶段成绩

<% if games.present? %> <% games&.each_with_index do |game, index| %> <% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %> <% user_score = q.exercise_shixun_answers.where(exercise_shixun_challenge_id: game_score&.first&.id,user_id: @ex_user_user.id) %> <% end %> <% else %> <% q.exercise_shixun_challenges.each_with_index do |game, index| %> <% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %> <% end %> <% end %>
关卡 任务名称 评测次数 完成时间 耗时 经验值 得分/满分
<%= index + 1 %> <%= game.challenge.subject %> <%= game.evaluate_count %> <%= game.end_time.present? ? game.end_time.strftime("%Y-%m-%d %H:%M") : "--" %> <%= ApplicationController.helpers.time_consuming game %> <%= game.final_score %> / <%= game.challenge.all_score %> <%= user_score.present? ? user_score.first.score : 0.0 %> / <%= game_score.present? ? game_score.first.question_score : 0.0 %>
<%= index + 1 %> <%= game.challenge.subject %> 0 -- -- 0.0 / <%= game.challenge.all_score %> 0.0 / <%= game_score.present? ? game_score.first.question_score : 0.0 %>

实训详情

<% games&.each_with_index do |game, index| %>

第<%= index+1 %>关<%= game.challenge.subject %>

<% if game.outputs.present? %> <% outputs = game.outputs.group("query_index") %> <% outputs.reverse.try(:each) do |output| %> <% end %>
评测次数 评测信息
<%= "第#{output.query_index}次" %> <%= output_detail(game, output) %>
<% end %> <% if game.try(:lastest_code).present? && game.challenge.st == 0 %> <% con_rows = content_line(game.lastest_code) %>

最近通过的代码 <%= game.challenge.path %>

<% end %>
<% end %>
<% end %>
<% if ques_comment.present? && ques_comment.first.comment.present? %> <% ques_user = ques_comment.first.user %>

<%= ques_user.real_name %><%= ques_comment.first.updated_at.strftime('%Y-%m-%d %H:%M') %>

<%= ques_comment.first.comment %>

<% end %> <% end %>