default result sorting to quiz submission descending

completes #85
This commit is contained in:
Mark Moser
2016-12-04 16:41:07 -06:00
parent 73df3d1258
commit 9cf2aeb139
6 changed files with 28 additions and 7 deletions

View File

@ -10,7 +10,9 @@ module Admin
# TODO: Limit results to the quizzes current_user has access to
def index
@candidates = Candidate.where(completed: true).includes(:recruiter)
@candidates = Candidate.where(completed: true)
.includes(:recruiter)
.order(:review_status, completed_at: :desc)
end
def view

View File

@ -35,7 +35,7 @@ class QuizController < ApplicationController
private
def complete_and_email
if current_candidate.update_attributes(completed: true)
if current_candidate.update_attributes(completed: true, completed_at: DateTime.current)
current_candidate.build_reviews
CandidateMailer.submitted(current_candidate).deliver_later
RecruiterMailer.candidate_submitted(current_candidate).deliver_later

View File

@ -8,6 +8,7 @@
<th>Test ID</th>
<th>Experience</th>
<th>Recruiter</th>
<th>Submitted on</th>
<th>Interview?</th>
</tr>
@ -16,6 +17,7 @@
<td><%= link_to candidate.test_hash, admin_result_path(candidate.test_hash) %></td>
<td><%= candidate.experience %> years</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 %>