<table class="table table-hover text-center myshixun-list-table">
  <thead class="thead-light">
  <tr>
    <th width="4%">序号</th>
    <th width="6%">ID</th>
    <th width="10%">标识</th>
    <th width="18%" class="text-left">实训名称</th>
    <th width="10%">实训老师</th>
    <th width="6%">完成</th>
    <th width="6%">经验值</th>
    <th width="10%">学员姓名</th>
    <th width="16%" class="text-left">学员单位</th>
    <th width="14%"><%= sort_tag('开启时间', name: 'created_at', path: admins_myshixuns_path) %></th>
  </tr>
  </thead>
  <tbody>
  <% if myshixuns.present? %>
    <% myshixuns.each_with_index do |myshixun, index| %>
      <tr class="myshixun-item-<%= myshixun.id %>">
        <td><%= list_index_no(@params_page.to_i, index) %></td>
        <td><%= myshixun.id %></td>
        <td><%= myshixun.identifier %></td>
        <td class="text-left">
          <% if myshixun.shixun.is_jupyter? %>
            <%= link_to "/tasks/#{myshixun.identifier}/jupyter", target: '_blank' do %>
              <%= overflow_hidden_span myshixun.shixun.name, width: 200 %>
            <% end %>
          <% else %>
            <% current_task = myshixun.last_executable_task || myshixun.last_task %>
            <% if current_task %>
              <%= link_to "/tasks/#{current_task.identifier}", target: '_blank' do %>
                <%= overflow_hidden_span myshixun.shixun.name, width: 200 %>
              <% end %>
            <% end %>
          <% end %>
        </td>
        <td><%= myshixun.shixun.user.real_name %></td>
        <td><%= finish_game_count.fetch(myshixun.id, 0) %>/<%= myshixun.shixun.challenges_count %></td>
        <td><%= total_score.fetch(myshixun.id, 0) %></td>
        <td>
          <%= link_to "/users/#{myshixun.user.login}", target: '_blank' do %>
            <%= overflow_hidden_span myshixun.user.real_name, width: 80 %>
          <% end %>
        </td>
        <td class="text-left"><%= overflow_hidden_span myshixun.user&.school_name, width: 150 %></td>
        <td><%= myshixun.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
      </tr>
    <% end %>
  <% else %>
    <%= render 'admins/shared/no_data_for_table' %>
  <% end %>
  </tbody>
</table>

<%= render partial: 'admins/shared/paginate', locals: { objects: myshixuns } %>