diff --git a/app/controllers/admin/candidate_controller.rb b/app/controllers/admin/candidate_controller.rb index a7d9615..8a289b1 100644 --- a/app/controllers/admin/candidate_controller.rb +++ b/app/controllers/admin/candidate_controller.rb @@ -57,7 +57,9 @@ module Admin private def candidate_params - params.require(:candidate).permit(:name, :email, :experience, :quiz_id, :project) + params.require(:candidate).permit( + :name, :email, :experience, :quiz_id, :project, :position, :skill_needs + ) end def collect_quizzes diff --git a/app/models/candidate.rb b/app/models/candidate.rb index 2d445d8..56083a1 100644 --- a/app/models/candidate.rb +++ b/app/models/candidate.rb @@ -16,6 +16,7 @@ class Candidate < ApplicationRecord validates :name, presence: true validates :experience, presence: true validates :project, presence: true + validates :position, 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 6337130..1330165 100644 --- a/app/views/admin/candidate/_form.html.erb +++ b/app/views/admin/candidate/_form.html.erb @@ -21,6 +21,19 @@ <%= form.text_field :project %> +
+ <%= form.radio_button :position, 'full-time' %> + <%= form.label "position_full-time", "Full-time" %> + + <%= form.radio_button :position, 'contract' %> + <%= form.label :position_contract, "Contract" %> +
+ +
+ <%= form.label :skill_needs, "Specific skill needs" %> + <%= form.text_field :skill_needs %> +
+
<%= form.label :quiz_id, "Quiz" %> <%= form.select :quiz_id, quiz_options(quizzes, candidate.quiz_id), include_blank: (quizzes.size > 1) %> diff --git a/db/migrate/20170227154554_add_attributes_to_candidate.rb b/db/migrate/20170227154554_add_attributes_to_candidate.rb new file mode 100644 index 0000000..bac89ff --- /dev/null +++ b/db/migrate/20170227154554_add_attributes_to_candidate.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true +class AddAttributesToCandidate < ActiveRecord::Migration[5.0] + def change + add_column :candidates, :skill_needs, :string, after: :project + add_column :candidates, :position, :string, after: :project + end +end diff --git a/db/schema.rb b/db/schema.rb index ae6704d..ddc3263 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: 20170210165110) do +ActiveRecord::Schema.define(version: 20170227154554) do create_table "answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| t.integer "candidate_id" @@ -31,6 +31,8 @@ ActiveRecord::Schema.define(version: 20170210165110) do t.string "email" t.string "experience" t.string "project" + t.string "position" + t.string "skill_needs" 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 891e039..8ebd2ba 100644 --- a/test/controllers/admin/candidate_controller/new_candidate_test.rb +++ b/test/controllers/admin/candidate_controller/new_candidate_test.rb @@ -27,6 +27,7 @@ module Admin name: 'new name', email: 'test@mailinator.com', experience: '0-3', + position: 'full-time', project: 'client project', quiz_id: quizzes(:fed).id } } diff --git a/test/fixtures/candidates.yml b/test/fixtures/candidates.yml index ea629f1..46608f7 100644 --- a/test/fixtures/candidates.yml +++ b/test/fixtures/candidates.yml @@ -5,6 +5,8 @@ roy: # Roy should have started, and is ready for a reminder email: <%= CryptSerializer.dump 'roy.cruz@mailinator.com' %> experience: 0-3 project: Client/Project + position: 'full-time' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: false @@ -16,6 +18,8 @@ gillian: # Gillian has not begun the test email: <%= CryptSerializer.dump 'gillian.anderson@mailinator.com' %> experience: 4-6 project: Client/Project + position: 'full-time' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: false @@ -27,6 +31,8 @@ martha: # Martha has not begun the test email: <%= CryptSerializer.dump 'martha.watts@mailinator.com' %> experience: 4-6 project: Client/Project + position: 'contract' + skill_needs: 'angular' recruiter: recruiter quiz: fed completed: false @@ -38,6 +44,8 @@ dawn: # Dawn has completed, and been reminded, but not submitted the test email: <%= CryptSerializer.dump 'dawn.hopkins@mailinator.com' %> experience: 0-2 project: Client/Project + position: 'contract' + skill_needs: 'javascript' recruiter: recruiter quiz: fed completed: false @@ -49,6 +57,8 @@ peggy: # Peggy has completed, and been reminded, but not submitted the test email: <%= CryptSerializer.dump 'peggy.blisters@mailinator.com' %> experience: 0-2 project: Client/Project + position: 'contract' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: false @@ -60,6 +70,8 @@ richard: # Richard has completed AND submitted the test email: <%= CryptSerializer.dump 'richard.burns@mailinator.com' %> experience: 15+ project: Client/Project + position: 'full-time' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: true @@ -73,6 +85,8 @@ juan: # Juan has chosen "finish later" for live coders email: <%= CryptSerializer.dump 'juan.campbell@mailinator.com' %> experience: 15+ project: Client/Project + position: 'full-time' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: false @@ -84,6 +98,8 @@ stacy: # Stacy has completed AND submitted the test email: <%= CryptSerializer.dump 'stacy.scott@mailinator.com' %> experience: 7-9 project: Client/Project + position: 'full-time' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: true @@ -97,6 +113,8 @@ henry: # Henry has completed AND submitted the test email: <%= CryptSerializer.dump 'henry.butler@mailinator.com' %> experience: 4-6 project: Client/Project + position: 'full-time' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: true @@ -109,6 +127,8 @@ wade: # Wade has completed AND submitted the test email: <%= CryptSerializer.dump 'wade.armstrong@mailinator.com' %> experience: 0-3 project: Client/Project + position: 'full-time' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: true @@ -121,6 +141,8 @@ jorge: # Jorge has completed AND submitted the test email: <%= CryptSerializer.dump 'jorge.holmes@mailinator.com' %> experience: 0-3 project: Client/Project + position: 'full-time' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: true @@ -133,6 +155,8 @@ elsie: # Elsie has completed AND submitted the test email: <%= CryptSerializer.dump 'elsie.lowe@mailinator.com' %> experience: 0-3 project: Client/Project + position: 'full-time' + skill_needs: 'css/html' recruiter: recruiter quiz: fed completed: true @@ -145,6 +169,8 @@ gustov: # Gustov is NOT for FED email: <%= CryptSerializer.dump 'gustov@mailinator.com' %> experience: 0-3 project: Client/Project + position: 'full-time' + skill_needs: 'C#, SQL' recruiter: recruiter quiz: admin completed: false diff --git a/test/models/candidate_test.rb b/test/models/candidate_test.rb index 1fef679..5b9ea44 100644 --- a/test/models/candidate_test.rb +++ b/test/models/candidate_test.rb @@ -18,6 +18,7 @@ class CandidateTest < ActiveSupport::TestCase email: email, experience: '0-3', project: 'Client', + position: 'full-time', recruiter_id: users(:recruiter).id, quiz_id: quizzes(:fed).id)