Add more attributes to candidate - completes: #100

This commit is contained in:
Mark Moser 2017-02-27 11:11:28 -06:00
parent 7f8e74c6b3
commit 4ba35ccf33
8 changed files with 55 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -21,6 +21,19 @@
<%= form.text_field :project %>
</div>
<div class="form-group">
<%= form.radio_button :position, 'full-time' %>
<%= form.label "position_full-time", "Full-time" %>
<%= form.radio_button :position, 'contract' %>
<%= form.label :position_contract, "Contract" %>
</div>
<div class="form-group">
<%= form.label :skill_needs, "Specific skill needs" %>
<%= form.text_field :skill_needs %>
</div>
<div class="form-group">
<%= form.label :quiz_id, "Quiz" %>
<%= form.select :quiz_id, quiz_options(quizzes, candidate.quiz_id), include_blank: (quizzes.size > 1) %>

View File

@ -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

View File

@ -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"

View File

@ -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
} }

View File

@ -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

View File

@ -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)