diff --git a/app/controllers/admin/candidate_controller.rb b/app/controllers/admin/candidate_controller.rb index 843f762..7564886 100644 --- a/app/controllers/admin/candidate_controller.rb +++ b/app/controllers/admin/candidate_controller.rb @@ -54,7 +54,7 @@ module Admin private def candidate_params - params.require(:candidate).permit(:name, :email, :experience, :quiz_id) + params.require(:candidate).permit(:name, :email, :experience, :quiz_id, :project) end def collect_quizzes diff --git a/app/models/candidate.rb b/app/models/candidate.rb index 21e6ac8..5d4df2b 100644 --- a/app/models/candidate.rb +++ b/app/models/candidate.rb @@ -14,6 +14,7 @@ class Candidate < ApplicationRecord validates :recruiter_id, presence: true validates :name, presence: true validates :experience, presence: true + validates :project, presence: true validates :email, uniqueness: true, presence: true, email_format: true validates :test_hash, uniqueness: true, presence: true diff --git a/app/views/admin/candidate/_form.html.erb b/app/views/admin/candidate/_form.html.erb index 0310471..6337130 100644 --- a/app/views/admin/candidate/_form.html.erb +++ b/app/views/admin/candidate/_form.html.erb @@ -16,6 +16,11 @@ <%= form.select :experience, experience_options(candidate.experience), include_blank: false %> +
+ <%= form.label :project, "Client or project" %> + <%= form.text_field :project %> +
+
<%= form.label :quiz_id, "Quiz" %> <%= form.select :quiz_id, quiz_options(quizzes, candidate.quiz_id), include_blank: (quizzes.size > 1) %> diff --git a/app/views/admin/result/index.html.erb b/app/views/admin/result/index.html.erb index 96ab9f4..6faa58f 100644 --- a/app/views/admin/result/index.html.erb +++ b/app/views/admin/result/index.html.erb @@ -7,6 +7,7 @@ Test ID Experience + Client/Project Recruiter Submitted on Interview? @@ -16,6 +17,7 @@ <%= link_to candidate.test_hash, admin_result_path(candidate.test_hash) %> <%= candidate.experience %> years + <%= candidate.project %> <%= mail_to(candidate.recruiter.email) %> <%= candidate.completed_at.strftime('%D') unless candidate.completed_at.nil? %> <%= candidate.interview? %> diff --git a/app/views/admin/result/view.html.erb b/app/views/admin/result/view.html.erb index 61863fa..d0452ca 100644 --- a/app/views/admin/result/view.html.erb +++ b/app/views/admin/result/view.html.erb @@ -9,6 +9,7 @@
Test ID: <%= @candidate.test_hash %>
Years of Experience: <%= @candidate.experience %>
+ Client/Project: <%= @candidate.project %>
Recruiter Email: <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %>
diff --git a/app/views/recruiter_mailer/candidate_created.html.inky b/app/views/recruiter_mailer/candidate_created.html.inky index 0a9cc9e..dcd04c7 100644 --- a/app/views/recruiter_mailer/candidate_created.html.inky +++ b/app/views/recruiter_mailer/candidate_created.html.inky @@ -7,8 +7,9 @@ Candidate email: <%= @candidate.email %>
Candidate ID: <%= @candidate.test_hash %>
Years of experience: <%= @candidate.experience %> Years
+ Client/Project: <%= @candidate.project %>

You will be notified when the candidate has finished taking the test.

- \ No newline at end of file + diff --git a/app/views/recruiter_mailer/candidate_created.text.erb b/app/views/recruiter_mailer/candidate_created.text.erb index 56b001b..c16e184 100644 --- a/app/views/recruiter_mailer/candidate_created.text.erb +++ b/app/views/recruiter_mailer/candidate_created.text.erb @@ -6,5 +6,6 @@ Candidate name: <%= @candidate.name %> Candidate email: <%= @candidate.email %> Candidate ID: <%= @candidate.test_hash %> Years of experience: <%= @candidate.experience %> Years +Client/Project: <%= @candidate.project %> You will be notified when the candidate has finished taking the test. diff --git a/app/views/reviewer_mailer/candidate_submission.html.inky b/app/views/reviewer_mailer/candidate_submission.html.inky index 1c5a20f..eeaed3d 100644 --- a/app/views/reviewer_mailer/candidate_submission.html.inky +++ b/app/views/reviewer_mailer/candidate_submission.html.inky @@ -1,6 +1,9 @@ diff --git a/app/views/reviewer_mailer/candidate_submission.text.erb b/app/views/reviewer_mailer/candidate_submission.text.erb index e81acc2..7120c2e 100644 --- a/app/views/reviewer_mailer/candidate_submission.text.erb +++ b/app/views/reviewer_mailer/candidate_submission.text.erb @@ -1,5 +1,5 @@ PERFICIENT/digital SKILLS ASSESSMENT RESULTS -Candidate <%= @candidate.test_hash %> has completed the Skills Assessment Test. +Candidate <%= @candidate.test_hash %> has completed the Skills Assessment Test for client/project <%= @candidate.project %>. You can view the results here: <%= admin_result_url(@candidate.test_hash) %>. diff --git a/db/migrate/20170208212526_add_project_to_client.rb b/db/migrate/20170208212526_add_project_to_client.rb new file mode 100644 index 0000000..e3adda1 --- /dev/null +++ b/db/migrate/20170208212526_add_project_to_client.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true +class AddProjectToClient < ActiveRecord::Migration[5.0] + def change + add_column :candidates, :project, :string, after: :experience + end +end diff --git a/db/schema.rb b/db/schema.rb index dc15ecc..5e5c4cc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161204220527) do +ActiveRecord::Schema.define(version: 20170208212526) do create_table "answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| t.integer "candidate_id" @@ -30,6 +30,7 @@ ActiveRecord::Schema.define(version: 20161204220527) do t.string "name" t.string "email" t.string "experience" + t.string "project" t.integer "recruiter_id" t.boolean "completed" t.datetime "completed_at" diff --git a/test/controllers/admin/candidate_controller/new_candidate_test.rb b/test/controllers/admin/candidate_controller/new_candidate_test.rb index c59f58c..891e039 100644 --- a/test/controllers/admin/candidate_controller/new_candidate_test.rb +++ b/test/controllers/admin/candidate_controller/new_candidate_test.rb @@ -23,8 +23,13 @@ module Admin assert_enqueued_jobs 2 do assert_difference("Candidate.count") do - post admin_create_candidate_path, params: { candidate: - { name: 'new name', email: 'test@mailinator.com', experience: '0-3', quiz_id: quizzes(:fed).id } } + post admin_create_candidate_path, params: { candidate: { + name: 'new name', + email: 'test@mailinator.com', + experience: '0-3', + project: 'client project', + quiz_id: quizzes(:fed).id + } } end end assert_redirected_to admin_candidates_path diff --git a/test/fixtures/candidates.yml b/test/fixtures/candidates.yml index 354fc68..f5cf861 100644 --- a/test/fixtures/candidates.yml +++ b/test/fixtures/candidates.yml @@ -4,6 +4,7 @@ roy: # Roy should have started, and is ready for a reminder name: Roy Cruz email: <%= CryptSerializer.dump 'roy.cruz@mailinator.com' %> experience: 0-3 + project: Client/Project recruiter: recruiter quiz: fed completed: false @@ -14,6 +15,7 @@ gillian: # Gillian has not begun the test name: Gillian Anderson email: <%= CryptSerializer.dump 'gillian.anderson@mailinator.com' %> experience: 4-6 + project: Client/Project recruiter: recruiter quiz: fed completed: false @@ -24,6 +26,7 @@ martha: # Martha has not begun the test name: Martha Watts email: <%= CryptSerializer.dump 'martha.watts@mailinator.com' %> experience: 4-6 + project: Client/Project recruiter: recruiter quiz: fed completed: false @@ -34,6 +37,7 @@ dawn: # Dawn has completed, and been reminded, but not submitted the test name: Dawn Hopkins email: <%= CryptSerializer.dump 'dawn.hopkins@mailinator.com' %> experience: 0-2 + project: Client/Project recruiter: recruiter quiz: fed completed: false @@ -44,6 +48,7 @@ peggy: # Peggy has completed, and been reminded, but not submitted the test name: Peggy Blisters email: <%= CryptSerializer.dump 'peggy.blisters@mailinator.com' %> experience: 0-2 + project: Client/Project recruiter: recruiter quiz: fed completed: false @@ -54,6 +59,7 @@ richard: # Richard has completed AND submitted the test name: Richard Burns email: <%= CryptSerializer.dump 'richard.burns@mailinator.com' %> experience: 15+ + project: Client/Project recruiter: recruiter quiz: fed completed: true @@ -66,6 +72,7 @@ juan: # Juan has chosen "finish later" for live coders name: Juan Campbell email: <%= CryptSerializer.dump 'juan.campbell@mailinator.com' %> experience: 15+ + project: Client/Project recruiter: recruiter quiz: fed completed: false @@ -76,6 +83,7 @@ stacy: # Stacy has completed AND submitted the test name: Stacy Scott email: <%= CryptSerializer.dump 'stacy.scott@mailinator.com' %> experience: 7-9 + project: Client/Project recruiter: recruiter quiz: fed completed: true @@ -88,6 +96,7 @@ henry: # Henry has completed AND submitted the test name: Henry Butler email: <%= CryptSerializer.dump 'henry.butler@mailinator.com' %> experience: 4-6 + project: Client/Project recruiter: recruiter quiz: fed completed: true @@ -99,6 +108,7 @@ wade: # Wade has completed AND submitted the test name: Wade Armstrong email: <%= CryptSerializer.dump 'wade.armstrong@mailinator.com' %> experience: 0-3 + project: Client/Project recruiter: recruiter quiz: fed completed: true @@ -110,6 +120,7 @@ gustov: # Gustov is NOT for FED name: Gustov email: <%= CryptSerializer.dump 'gustov@mailinator.com' %> experience: 0-3 + project: Client/Project recruiter: recruiter quiz: admin completed: false diff --git a/test/models/candidate_test.rb b/test/models/candidate_test.rb index 393c7e8..1fef679 100644 --- a/test/models/candidate_test.rb +++ b/test/models/candidate_test.rb @@ -6,6 +6,7 @@ class CandidateTest < ActiveSupport::TestCase candidate = Candidate.create(name: 'new name', email: 'test@mailinator.com', experience: '0-3', + project: 'Client', quiz_id: quizzes(:fed).id) assert candidate.test_hash.present? @@ -16,6 +17,7 @@ class CandidateTest < ActiveSupport::TestCase candidate = Candidate.create(name: 'new name', email: email, experience: '0-3', + project: 'Client', recruiter_id: users(:recruiter).id, quiz_id: quizzes(:fed).id)