<h3>
  <%=l(:label_code_work_tests)%>
</h3>

&nbsp;


<div class="autoscroll">
  <table class="list" style="width: 100%;table-layout: fixed">
    <thead>
    <tr>
      <th style="width: 50px;">
        <span style="float:left; margin-left:20px;">作业id</span>
      </th>
      <th style="width: 50px;">
        <span style="float:left; margin-left:20px;">作品id</span>
      </th>
      <th style="width: 60px;">
        用户等待时间
      </th>
      <th style="width: 50px;">
        <span style="float:left; margin-left:20px;">语言</span>
      </th>
      <th style="width: 100px;">
        测试完成时间
      </th>
      <th style="width: 80px;">
        <span style="float:left; margin-left:30px;">答题状态</span>
      </th>
      <th style="width: 50px;">
        <span style="float:left; margin-left:20px;">耗时</span>
      </th>
    </tr>
    </thead>
    <tbody>
    <% @code_work_tests.each do |test| %>
        <% if test['homework_id'] != nil %>
            <tr class="<%= cycle("odd", "even") %>">
              <td style="text-align: center; " title='<%=test['homework_id']%>'>
                <% if test['link_hwork'] %>
                    <%=link_to(test['homework_id'], student_work_index_path(:homework => test['homework_id']))%>
                <% else %>
                    <%= test['homework_id'] %>
                <% end %>
              </td>
              <td style="text-align: center; " title='<%=test['student_work_id']%>'>
                <% if test['link_swork'] && test['link_hwork'] %>
                    <% if !test['is_test'] %>
                        <%=link_to(test['student_work_id'], student_work_index_path(:homework => test['homework_id'],:student_work_id=>test['student_work_id']))%>
                    <% else %>
                        <%=link_to(test['student_work_id'], new_user_commit_homework_users_path(homework_id: test['homework_id'], is_test: true))%>
                    <% end %>
                <% else %>
                     <%= test['student_work_id'] %>
                <% end %>
              </td>
              <td style="text-align: center;">
                    <% if test.wait_time != 0 %>
                        <%=test.wait_time.to_s+"毫秒" %>
                    <% else %>
                        <%="未记录"%>
                    <% end %>
              </td>
              <td align="center">
                <%=%W(C C++ Python Java).at(test['language'].to_i - 1)%>
              </td>
              <td align="center">
                <%=Time.parse(test.created_at.to_s).strftime("%Y-%m-%d %H:%M:%S")%>
              </td>
              <td align="center">
                <% if test.status == 0 %>
                    <%= "答题正确" %>
                <% elsif test.status == -2 %>
                    <%= "编译错误" %>
                <% elsif test.status == 2 %>
                    <%= "代码超时" %>
                <% elsif test.status == -3 %>
                    <%= "请求超时" %>
                <% elsif test.status == -4 %>
                    <%= "judge代码出错!" %>
                <% elsif test.status == -5 %>
                    <%= "trustie代码出错!" %>
                <% else %>
                    <%= "答题错误" %>
                <% end %>
              </td>
              <td class="center">
                <% if test.time_used > 0 %>
                    <%=test.time_used.to_s+"毫秒"%>
                <% end %>
              </td>
            </tr>
        <% end %>
    <% end %>
    </tbody>
  </table>
</div>

<div class="pagination">
  <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>

<% html_title(l(:label_code_work_tests)) -%>