|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="container" style="background-color:#fff;">
|
|
|
<div>
|
|
|
<div class="ex-title text-center mbt20">
|
|
|
<div class="mbt10">
|
|
|
<h3><%= @exercise.try(:exercise_name) %></h3>
|
|
|
</div>
|
|
|
<div class="plr15">
|
|
|
<p class="text-gray">
|
|
|
<%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description)&.html_safe %>
|
|
|
</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="mbt20 bgc">
|
|
|
<div class="ex-scores pd10 text-gray fs13">
|
|
|
<p class="clearfix">
|
|
|
<% if @exercise_single_ques_count > 0 %>
|
|
|
<span class="mr15">单选题<span class="mlr5"><%= @exercise_single_ques_count %></span>题,
|
|
|
共<span class="mlr5"><%= @exercise_single_ques_scores %></span>分</span>
|
|
|
<% end %>
|
|
|
<% if @exercise_double_ques_count > 0 %>
|
|
|
<span class="mr15">多选题<span class="mlr5"><%= @exercise_double_ques_count %></span>题,
|
|
|
共<span class="mlr5"><%= @exercise_double_ques_scores %></span>分</span>
|
|
|
<% end %>
|
|
|
<% if @exercise_ques_judge_count > 0 %>
|
|
|
<span class="mr15">判断题<span class="mlr5"><%= @exercise_ques_judge_count %></span>题,
|
|
|
共<span class="mlr5"><%= @exercise_ques_judge_scores %></span>分</span>
|
|
|
<% end %>
|
|
|
<% if @exercise_ques_null_count > 0 %>
|
|
|
<span class="mr15">填空题<span class="mlr5"><%= @exercise_ques_null_count %></span>题,
|
|
|
共<span class="mlr5"><%= @exercise_ques_null_scores %></span>分</span>
|
|
|
<% end %>
|
|
|
<% if @exercise_ques_main_count > 0 %>
|
|
|
<span class="mr15">主观题<span class="mlr5"><%= @exercise_ques_main_count %></span>题,
|
|
|
共<span class="mlr5"><%= @exercise_ques_main_scores %></span>分</span>
|
|
|
<% end %>
|
|
|
<% if @exercise_ques_shixun_count > 0 %>
|
|
|
<span class="mr15">实训题<span class="mlr5"><%= @exercise_ques_shixun_count %></span>题,
|
|
|
共<span class="mlr5"><%= @exercise_ques_shixun_scores %></span>分</span>
|
|
|
<% end %>
|
|
|
|
|
|
<% if @exercise_ques_count > 0 %>
|
|
|
<span class="pull-right">
|
|
|
共<span class="text-orange mlr5"><%= @exercise_ques_scores %></span>分
|
|
|
</span>
|
|
|
<span class="mr15 pull-right">
|
|
|
合计<span class="text-blue mlr5"><%= @exercise_ques_count %></span>题
|
|
|
</span>
|
|
|
<% end %>
|
|
|
</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="mbt10">
|
|
|
<% if @ex_obj_array.size > 0 %>
|
|
|
<div>
|
|
|
<p class="pbt10">
|
|
|
<span class="mr15">客观题</span>
|
|
|
<span class="mlr5"><span class="line-line bg-green"></span>正确</span>
|
|
|
<span class="mlr5"><span class="line-line bg-red"></span>错误</span>
|
|
|
<span class="mlr5"><span class="line-line bg-orange"></span>部分得分</span>
|
|
|
<span class="pull-right">总分:<span class="text-orange"><%= @exercise_user&.score %>分</span></span>
|
|
|
</p>
|
|
|
</div>
|
|
|
<div class="pbt5">
|
|
|
<% @ex_obj_array.each do |s| %>
|
|
|
<% if s[:stand_status] == 1 %>
|
|
|
<div class="inline-block right-status bg-green">
|
|
|
<span><%= s[:q_position] %></span>
|
|
|
</div>
|
|
|
<% elsif s[:stand_status] == 0 %>
|
|
|
<div class="inline-block right-status bg-red">
|
|
|
<span><%= s[:q_position] %></span>
|
|
|
</div>
|
|
|
<% else %>
|
|
|
<div class="inline-block right-status bg-orange">
|
|
|
<span><%= s[:q_position] %></span>
|
|
|
</div>
|
|
|
<% end %>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
<% end %>
|
|
|
<% if @ex_sub_array.size > 0 %>
|
|
|
<div>
|
|
|
<p class="pbt10">
|
|
|
<span class="mr15">主观题</span>
|
|
|
<span class="mlr5"><span class="circle-review bg-gray"></span>已评</span>
|
|
|
<span class="mlr5"><span class="circle-review"></span>未评</span>
|
|
|
<span class="pull-right text-gray">开始答题时间:<%= @exercise_user.start_at.present? ? @exercise_user.start_at.strftime("%Y-%m-%d %H:%M") : "--" %></span>
|
|
|
</p>
|
|
|
</div>
|
|
|
<div class="pbt5">
|
|
|
<% @ex_sub_array.each do |s| %>
|
|
|
<% if s[:stand_status] == 0 %>
|
|
|
<div class="inline-block right-status bd-radius">
|
|
|
<span class="text-gray"><%= s[:q_position] %></span>
|
|
|
</div>
|
|
|
<% else %>
|
|
|
<div class="inline-block right-status bg-gray">
|
|
|
<span><%= s[:q_position] %></span>
|
|
|
</div>
|
|
|
<% end %>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
<div class="mbt10">
|
|
|
<% @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) %>
|
|
|
<div class="bdc">
|
|
|
<div class="pbt10">
|
|
|
<div class="position-relative">
|
|
|
<div class="pbt5">
|
|
|
<span class="mr5 text-blue"><%= q.question_number %>、 </span>
|
|
|
<span class="text-blue">
|
|
|
<%= q.question_type_name %>
|
|
|
</span>
|
|
|
<span class="text-gray mlr5">(<%= q&.question_score %>分)</span>
|
|
|
<% if q_type == 5 %>
|
|
|
<span class="user-score">
|
|
|
<% if this_ques_status.present? && this_ques_status[:stand_status] == 1 %>
|
|
|
<span class="circle-score circle-right bg-green mr15"></span>
|
|
|
<span class="text-green mr3"><%= this_ques_status[:user_score] %></span>分
|
|
|
<% elsif this_ques_status.present? && this_ques_status[:stand_status] == 2 %>
|
|
|
<span class="circle-score circle-wrong bg-orange mr15"></span>
|
|
|
<span class="text-orange mr3"><%= this_ques_status[:user_score] %></span>分
|
|
|
<% else %>
|
|
|
<span class="circle-score circle-wrong bg-red mr15"></span>
|
|
|
<span class="text-red mr3">0.0</span>分
|
|
|
<% end %>
|
|
|
</span>
|
|
|
<% elsif q_type == 4 %>
|
|
|
<span class="user-score">
|
|
|
<% if main_ques_status.present? && main_ques_status[:stand_status] == 1 %>
|
|
|
<span class="circle-score circle-right bg-green mr15"></span>
|
|
|
<span class="text-green mr3"><%= main_ques_status[:user_score] %></span>分
|
|
|
<% elsif main_ques_status.present? && main_ques_status[:stand_status] == 2 %>
|
|
|
<span class="circle-score circle-wrong bg-orange mr15"></span>
|
|
|
<span class="text-orange mr3"><%= main_ques_status[:user_score] %></span>分
|
|
|
<% else %>
|
|
|
<span class="text-red">未批</span>
|
|
|
<% end %>
|
|
|
</span>
|
|
|
<% else %>
|
|
|
<span class="user-score">
|
|
|
<% if this_ques_status.present? && this_ques_status[:stand_status] == 1 %>
|
|
|
<span class="circle-score circle-right bg-green mr15"></span>
|
|
|
<span class="text-green mr3"><%= this_ques_status[:user_score] %></span>分
|
|
|
<% elsif this_ques_status.present? && this_ques_status[:stand_status] == 2 %>
|
|
|
<span class="circle-score circle-wrong bg-orange mr15"></span>
|
|
|
<span class="text-orange mr3"><%= this_ques_status[:user_score] %></span>分
|
|
|
<% else %>
|
|
|
<span class="circle-score circle-wrong bg-red mr15"></span>
|
|
|
<span class="text-red mr3">0.0</span>分
|
|
|
<% end %>
|
|
|
</span>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
<div class="pbt5">
|
|
|
<% if q_type == 5 %>
|
|
|
<span class="ques-title"><%= q.shixun_name&.html_safe %></span>
|
|
|
<div class="mt8 text-gray">
|
|
|
<span><%= q.question_title&.html_safe %></span>
|
|
|
</div>
|
|
|
<% elsif q_type == 4 %>
|
|
|
<span class="ques-title"><%= q.question_title&.html_safe %></span>
|
|
|
<% else %>
|
|
|
<span class="ques-title"><%= q.question_title&.html_safe %></span>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="pbt5">
|
|
|
<% if q_type == 0 %>
|
|
|
<% q.exercise_choices.each_with_index do |s,index| %>
|
|
|
<% check_answer = (user_answer.present? && (s.id == user_answer.first.exercise_choice_id)) ? "choose-answer" : '' %>
|
|
|
<p class="pbt5">
|
|
|
<span class="choose-radio <%= check_answer %>"></span>
|
|
|
<span class="mr15"><%= convert_to_char((index+1).to_s)%></span><%= s.choice_text%>
|
|
|
</p>
|
|
|
<% end %>
|
|
|
<% elsif q_type == 1 %>
|
|
|
<% q.exercise_choices.each_with_index do |s,index| %>
|
|
|
<% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %>
|
|
|
<p class="pbt5">
|
|
|
<% if check_answer %>
|
|
|
<span class="choose-checkbox choose-answer-multi" ></span>
|
|
|
<% else %>
|
|
|
<span class="choose-checkbox"></span>
|
|
|
<% end %>
|
|
|
<span class="mr15"><%= convert_to_char((index+1).to_s)%></span><%= s.choice_text%>
|
|
|
</p>
|
|
|
<% end %>
|
|
|
<% elsif q_type == 2 %>
|
|
|
<p class="pbt5">
|
|
|
<% 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 %>
|
|
|
<span class="mr15">
|
|
|
<span class="choose-radio <%= check_answer %>"></span>
|
|
|
<span class="mlr5"><%= s.choice_text %></span>
|
|
|
</span>
|
|
|
<% end %>
|
|
|
</p>
|
|
|
<% 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 %>
|
|
|
<p class="pbt10 flex-nowrap">
|
|
|
<span class="pull-left line-34">答案(填空<%= index+1 %>):</span>
|
|
|
<span class="null-answer"><%= check_answer&.html_safe %></span>
|
|
|
</p>
|
|
|
<% end %>
|
|
|
<% elsif q_type == 4 %>
|
|
|
<% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %>
|
|
|
<p class="flex-nowrap">
|
|
|
<span class="null-answer main-height"><%= check_answer&.html_safe %></span>
|
|
|
</p>
|
|
|
<% else %>
|
|
|
<div class="mbt10">
|
|
|
<p class="text-gray mbt10">
|
|
|
<span>阶段成绩</span>
|
|
|
</p>
|
|
|
<table style="width:100%;" cellpadding="0" cellspacing="0" >
|
|
|
<thead class="bgc">
|
|
|
<th width="6%">关卡</th>
|
|
|
<th width="29%" style="text-align: left;">任务名称</th>
|
|
|
<th width="10%">评测次数</th>
|
|
|
<th width="13%">完成时间</th>
|
|
|
<th width="16%">耗时</th>
|
|
|
<th width="13%">经验值</th>
|
|
|
<th width="13%">得分/满分</th>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
<% 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) %>
|
|
|
<tr>
|
|
|
<td><%= index + 1 %></td>
|
|
|
<td style="text-align: left;">
|
|
|
<span class="task-hide edu-info-dark fl"><%= game.challenge.subject %></span>
|
|
|
</td>
|
|
|
<td><%= game.evaluate_count %></td>
|
|
|
<td><%= game.end_time.present? ? game.end_time.strftime("%Y-%m-%d %H:%M") : "--" %></td>
|
|
|
<td><%= ApplicationController.helpers.time_consuming game %></td>
|
|
|
<td><span class="text-green"><%= game.final_score %></span> / <%= game.challenge.all_score %></td>
|
|
|
<td><span class="text-orange"><%= user_score.present? ? user_score.first.score : 0.0 %> /</span> <%= game_score.present? ? game_score.first.question_score : 0.0 %></td>
|
|
|
</tr>
|
|
|
<% end %>
|
|
|
<% else %>
|
|
|
<% q.exercise_shixun_challenges.each_with_index do |game, index| %>
|
|
|
<% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %>
|
|
|
<tr>
|
|
|
<td><%= index + 1 %></td>
|
|
|
<td style="text-align: left;">
|
|
|
<span class="task-hide edu-info-dark fl"><%= game.challenge.subject %></span>
|
|
|
</td>
|
|
|
<td>0</td>
|
|
|
<td>--</td>
|
|
|
<td>--</td>
|
|
|
<td><span class="text-green">0.0</span> / <%= game.challenge.all_score %></td>
|
|
|
<td><span class="text-orange">0.0 /</span> <%= game_score.present? ? game_score.first.question_score : 0.0 %></td>
|
|
|
</tr>
|
|
|
<% end %>
|
|
|
<% end %>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</div>
|
|
|
<div class="mbt10">
|
|
|
<p class="text-gray mbt10">
|
|
|
<span class="fl font-bd">实训详情</span>
|
|
|
</p>
|
|
|
<% games&.each_with_index do |game, index| %>
|
|
|
<div class="mbt10">
|
|
|
<p class="clearfix">
|
|
|
<span class="fl mt3"><span class="font-bd mr15">第<%= index+1 %>关</span><%= game.challenge.subject %></span>
|
|
|
</p>
|
|
|
<div style="margin-left: 32px;" class="mt8 shixun-detail">
|
|
|
<% if game.outputs.present? %>
|
|
|
<table style="width:100%;" cellpadding="0" cellspacing="0">
|
|
|
<thead class="bgc">
|
|
|
<th width="10%">评测次数</th>
|
|
|
<th>评测信息</th>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
<% outputs = game.outputs.group("query_index") %>
|
|
|
<% outputs.reverse.try(:each) do |output| %>
|
|
|
<tr>
|
|
|
<td><%= "第#{output.query_index}次" %></td>
|
|
|
<td align="left" style="padding-left: 5px"><%= output_detail(game, output) %></td>
|
|
|
</tr>
|
|
|
<% end %>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
<% end %>
|
|
|
<% if game.try(:lastest_code).present? && game.challenge.st == 0 %>
|
|
|
<% con_rows = content_line(game.lastest_code) %>
|
|
|
<div class="mbt20">
|
|
|
<p class="bgc" >
|
|
|
<span class="pd10" style="display:inherit;">
|
|
|
<span class="fl">最近通过的代码</span>
|
|
|
<span class="pull-right"><%= game.challenge.path %></span>
|
|
|
</span>
|
|
|
</p>
|
|
|
<div class="bg-e pd10">
|
|
|
<textarea class="" id="content_show_<%= game.id %>" name="content" rows="<%= con_rows %>"><%= game.lastest_code %></textarea>
|
|
|
</div>
|
|
|
</div>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
</div>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<% if ques_comment.present? && ques_comment.first.comment.present? %>
|
|
|
<% ques_user = ques_comment.first.user %>
|
|
|
<div class="bdc">
|
|
|
<div class="pbt10">
|
|
|
<div class="inline-block pull-left">
|
|
|
<span><img src="/images/avatars/User/<%= ques_user.id %>" class="avatar-32"/></span>
|
|
|
</div>
|
|
|
<div class="ml38">
|
|
|
<p class="mb10"><span class="pr"><%= ques_user.real_name %></span><span class="plr15 text-gray"><%= ques_comment.first.updated_at.strftime('%Y-%m-%d %H:%M') %></span></p>
|
|
|
<p><%= ques_comment.first.comment %></p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<% end %>
|
|
|
<% end %>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</body>
|
|
|
</html>
|