<%
  content_for :section_title, "Completed Tests"
  content_for :title, "Quiz Results - Skills Assessment Admin"
%>

<h1>Results</h1>

<table cellspacing="0" cellpadding="0">
  <tr>
    <th><%= sortable "test_hash", "Test ID" %></th>
    <th><%= sortable "name" %></th>
    <th><%= sortable "project", "Client/Project" %></th>
    <th>Recruiter</th>
    <th><%= sortable  "completed_at", "Submitted on" %></th>
    <th>Interview?</th>
  </tr>

  <% @candidates.each do |candidate| %>
    <tr>
      <td><%= link_to candidate.test_hash, admin_result_path(candidate.test_hash) %></td>
      <td><%= candidate.name if !candidate.pending? %></td>
      <td><%= candidate.project %></td>
      <td><%= mail_to(candidate.recruiter.email) %></td>
      <td><%= candidate.completed_at.strftime('%D') unless candidate.completed_at.nil? %></td>
      <td><%= candidate.interview? %></td>
    </tr>
  <% end %>
</table>

<%= paginate @candidates %>
