parent
73df3d1258
commit
9cf2aeb139
@ -10,7 +10,9 @@ 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
|
||||||
@candidates = Candidate.where(completed: true).includes(:recruiter)
|
@candidates = Candidate.where(completed: true)
|
||||||
|
.includes(:recruiter)
|
||||||
|
.order(:review_status, completed_at: :desc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def view
|
def view
|
||||||
|
@ -35,7 +35,7 @@ class QuizController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def complete_and_email
|
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
|
current_candidate.build_reviews
|
||||||
CandidateMailer.submitted(current_candidate).deliver_later
|
CandidateMailer.submitted(current_candidate).deliver_later
|
||||||
RecruiterMailer.candidate_submitted(current_candidate).deliver_later
|
RecruiterMailer.candidate_submitted(current_candidate).deliver_later
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<th>Test ID</th>
|
<th>Test ID</th>
|
||||||
<th>Experience</th>
|
<th>Experience</th>
|
||||||
<th>Recruiter</th>
|
<th>Recruiter</th>
|
||||||
|
<th>Submitted on</th>
|
||||||
<th>Interview?</th>
|
<th>Interview?</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -16,6 +17,7 @@
|
|||||||
<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.experience %> years</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.interview? %></td>
|
<td><%= candidate.interview? %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% 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
|
11
db/schema.rb
11
db/schema.rb
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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|
|
create_table "answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
||||||
t.integer "candidate_id"
|
t.integer "candidate_id"
|
||||||
@ -32,6 +32,7 @@ ActiveRecord::Schema.define(version: 20161120175737) do
|
|||||||
t.string "experience"
|
t.string "experience"
|
||||||
t.integer "recruiter_id"
|
t.integer "recruiter_id"
|
||||||
t.boolean "completed"
|
t.boolean "completed"
|
||||||
|
t.datetime "completed_at"
|
||||||
t.boolean "reminded"
|
t.boolean "reminded"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
@ -77,11 +78,11 @@ ActiveRecord::Schema.define(version: 20161120175737) do
|
|||||||
create_table "reviewer_votes", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
create_table "reviewer_votes", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
||||||
t.integer "candidate_id"
|
t.integer "candidate_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.integer "vote", default: 0, null: false
|
t.integer "vote", default: 0, null: false
|
||||||
t.integer "veto", default: 0, null: false
|
t.integer "veto", default: 0, null: false
|
||||||
t.datetime "last_reminded"
|
t.datetime "last_reminded"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["candidate_id", "user_id"], name: "index_reviewer_votes_on_candidate_id_and_user_id", unique: true, using: :btree
|
t.index ["candidate_id", "user_id"], name: "index_reviewer_votes_on_candidate_id_and_user_id", unique: true, using: :btree
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
|
completed_at: <%= DateTime.current %>
|
||||||
reminded: false
|
reminded: false
|
||||||
test_hash: 6NjnourLE6Y
|
test_hash: 6NjnourLE6Y
|
||||||
review_status: 1
|
review_status: 1
|
||||||
@ -78,6 +79,7 @@ stacy: # Stacy has completed AND submitted the test
|
|||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
|
completed_at: <%= DateTime.current %>
|
||||||
reminded: false
|
reminded: false
|
||||||
test_hash: s6oFExZliYYFx
|
test_hash: s6oFExZliYYFx
|
||||||
review_status: 2
|
review_status: 2
|
||||||
@ -89,6 +91,7 @@ henry: # Henry has completed AND submitted the test
|
|||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
|
completed_at: <%= DateTime.current %>
|
||||||
reminded: false
|
reminded: false
|
||||||
test_hash: egPomAuVDeCEp
|
test_hash: egPomAuVDeCEp
|
||||||
|
|
||||||
@ -99,6 +102,7 @@ wade: # Wade has completed AND submitted the test
|
|||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
|
completed_at: <%= DateTime.current %>
|
||||||
reminded: false
|
reminded: false
|
||||||
test_hash: BkSkpapJnkz2N
|
test_hash: BkSkpapJnkz2N
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user