parent
73df3d1258
commit
9cf2aeb139
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 %>
|
||||
|
12
db/migrate/20161204220527_add_completed_at.rb
Normal file
12
db/migrate/20161204220527_add_completed_at.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
class AddCompletedAt < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :candidates, :completed_at, :datetime, after: :completed
|
||||
|
||||
Candidate.reset_column_information
|
||||
Candidate.where(completed: true).each do |candidate|
|
||||
candidate.completed_at = candidate.updated_at
|
||||
candidate.save
|
||||
end
|
||||
end
|
||||
end
|
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20161120175737) do
|
||||
ActiveRecord::Schema.define(version: 20161204220527) do
|
||||
|
||||
create_table "answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
||||
t.integer "candidate_id"
|
||||
@ -32,6 +32,7 @@ ActiveRecord::Schema.define(version: 20161120175737) do
|
||||
t.string "experience"
|
||||
t.integer "recruiter_id"
|
||||
t.boolean "completed"
|
||||
t.datetime "completed_at"
|
||||
t.boolean "reminded"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
|
4
test/fixtures/candidates.yml
vendored
4
test/fixtures/candidates.yml
vendored
@ -57,6 +57,7 @@ richard: # Richard has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
reminded: false
|
||||
test_hash: 6NjnourLE6Y
|
||||
review_status: 1
|
||||
@ -78,6 +79,7 @@ stacy: # Stacy has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
reminded: false
|
||||
test_hash: s6oFExZliYYFx
|
||||
review_status: 2
|
||||
@ -89,6 +91,7 @@ henry: # Henry has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
reminded: false
|
||||
test_hash: egPomAuVDeCEp
|
||||
|
||||
@ -99,6 +102,7 @@ wade: # Wade has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
reminded: false
|
||||
test_hash: BkSkpapJnkz2N
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user