expose candidate name

completes #97
This commit is contained in:
Mark Moser 2017-03-02 16:13:08 -06:00
parent f2b2de9948
commit dbb355b4d3
3 changed files with 9 additions and 4 deletions

View File

@ -11,9 +11,11 @@ module Admin
# TODO: Limit results to the quizzes current_user has access to # TODO: Limit results to the quizzes current_user has access to
def index def index
sort_case = "(case when review_status = 0 then '' else name end)"
sort_with_case = sort_column == 'name' ? sort_case : sort_column
@candidates = Candidate.where(completed: true) @candidates = Candidate.where(completed: true)
.includes(:recruiter) .includes(:recruiter)
.order("#{sort_column} #{sort_direction}") .order("#{sort_with_case} #{sort_direction}")
.page(params[:page]) .page(params[:page])
end end
@ -28,7 +30,7 @@ module Admin
private private
def sort_column def sort_column
Candidate.column_names.include?(params[:sort]) ? params[:sort] : 'completed_at' @sort_col ||= Candidate.column_names.include?(params[:sort]) ? params[:sort] : 'completed_at'
end end
end end
end end

View File

@ -6,7 +6,7 @@
<table cellspacing="0" cellpadding="0"> <table cellspacing="0" cellpadding="0">
<tr> <tr>
<th><%= sortable "test_hash", "Test ID" %></th> <th><%= sortable "test_hash", "Test ID" %></th>
<th><%= sortable "experience" %></th> <th><%= sortable "name" %></th>
<th><%= sortable "project", "Client/Project" %></th> <th><%= sortable "project", "Client/Project" %></th>
<th>Recruiter</th> <th>Recruiter</th>
<th><%= sortable "completed_at", "Submitted on" %></th> <th><%= sortable "completed_at", "Submitted on" %></th>
@ -16,7 +16,7 @@
<% @candidates.each do |candidate| %> <% @candidates.each do |candidate| %>
<tr> <tr>
<td><%= link_to candidate.test_hash, admin_result_path(candidate.test_hash) %></td> <td><%= link_to candidate.test_hash, admin_result_path(candidate.test_hash) %></td>
<td><%= candidate.experience %> years</td> <td><%= candidate.name if !candidate.pending? %></td>
<td><%= candidate.project %></td> <td><%= candidate.project %></td>
<td><%= mail_to(candidate.recruiter.email) %></td> <td><%= mail_to(candidate.recruiter.email) %></td>
<td><%= candidate.completed_at.strftime('%D') unless candidate.completed_at.nil? %></td> <td><%= candidate.completed_at.strftime('%D') unless candidate.completed_at.nil? %></td>

View File

@ -8,6 +8,9 @@
<div class="review_meta"> <div class="review_meta">
<div> <div>
<% unless @candidate.pending? %>
<strong>Name:</strong> <%= @candidate.name %><br />
<% end %>
<strong>Test ID:</strong> <%= @candidate.test_hash %><br /> <strong>Test ID:</strong> <%= @candidate.test_hash %><br />
<strong>Years of Experience:</strong> <%= @candidate.experience %><br /> <strong>Years of Experience:</strong> <%= @candidate.experience %><br />
<strong>Client/Project:</strong> <%= @candidate.project %><br /> <strong>Client/Project:</strong> <%= @candidate.project %><br />