Add more attributes to candidate - completes: #100
This commit is contained in:
parent
7f8e74c6b3
commit
4ba35ccf33
@ -57,7 +57,9 @@ module Admin
|
|||||||
private
|
private
|
||||||
|
|
||||||
def candidate_params
|
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
|
end
|
||||||
|
|
||||||
def collect_quizzes
|
def collect_quizzes
|
||||||
|
@ -16,6 +16,7 @@ class Candidate < ApplicationRecord
|
|||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
validates :experience, presence: true
|
validates :experience, presence: true
|
||||||
validates :project, presence: true
|
validates :project, presence: true
|
||||||
|
validates :position, presence: true
|
||||||
validates :email, uniqueness: true, presence: true, email_format: true
|
validates :email, uniqueness: true, presence: true, email_format: true
|
||||||
validates :test_hash, uniqueness: true, presence: true
|
validates :test_hash, uniqueness: true, presence: true
|
||||||
|
|
||||||
|
@ -21,6 +21,19 @@
|
|||||||
<%= form.text_field :project %>
|
<%= form.text_field :project %>
|
||||||
</div>
|
</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">
|
<div class="form-group">
|
||||||
<%= form.label :quiz_id, "Quiz" %>
|
<%= form.label :quiz_id, "Quiz" %>
|
||||||
<%= form.select :quiz_id, quiz_options(quizzes, candidate.quiz_id), include_blank: (quizzes.size > 1) %>
|
<%= form.select :quiz_id, quiz_options(quizzes, candidate.quiz_id), include_blank: (quizzes.size > 1) %>
|
||||||
|
7
db/migrate/20170227154554_add_attributes_to_candidate.rb
Normal file
7
db/migrate/20170227154554_add_attributes_to_candidate.rb
Normal 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
|
@ -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: 20170210165110) do
|
ActiveRecord::Schema.define(version: 20170227154554) 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"
|
||||||
@ -31,6 +31,8 @@ ActiveRecord::Schema.define(version: 20170210165110) do
|
|||||||
t.string "email"
|
t.string "email"
|
||||||
t.string "experience"
|
t.string "experience"
|
||||||
t.string "project"
|
t.string "project"
|
||||||
|
t.string "position"
|
||||||
|
t.string "skill_needs"
|
||||||
t.integer "recruiter_id"
|
t.integer "recruiter_id"
|
||||||
t.boolean "completed"
|
t.boolean "completed"
|
||||||
t.datetime "completed_at"
|
t.datetime "completed_at"
|
||||||
|
@ -27,6 +27,7 @@ module Admin
|
|||||||
name: 'new name',
|
name: 'new name',
|
||||||
email: 'test@mailinator.com',
|
email: 'test@mailinator.com',
|
||||||
experience: '0-3',
|
experience: '0-3',
|
||||||
|
position: 'full-time',
|
||||||
project: 'client project',
|
project: 'client project',
|
||||||
quiz_id: quizzes(:fed).id
|
quiz_id: quizzes(:fed).id
|
||||||
} }
|
} }
|
||||||
|
26
test/fixtures/candidates.yml
vendored
26
test/fixtures/candidates.yml
vendored
@ -5,6 +5,8 @@ roy: # Roy should have started, and is ready for a reminder
|
|||||||
email: <%= CryptSerializer.dump 'roy.cruz@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'roy.cruz@mailinator.com' %>
|
||||||
experience: 0-3
|
experience: 0-3
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: false
|
completed: false
|
||||||
@ -16,6 +18,8 @@ gillian: # Gillian has not begun the test
|
|||||||
email: <%= CryptSerializer.dump 'gillian.anderson@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'gillian.anderson@mailinator.com' %>
|
||||||
experience: 4-6
|
experience: 4-6
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: false
|
completed: false
|
||||||
@ -27,6 +31,8 @@ martha: # Martha has not begun the test
|
|||||||
email: <%= CryptSerializer.dump 'martha.watts@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'martha.watts@mailinator.com' %>
|
||||||
experience: 4-6
|
experience: 4-6
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'contract'
|
||||||
|
skill_needs: 'angular'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: false
|
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' %>
|
email: <%= CryptSerializer.dump 'dawn.hopkins@mailinator.com' %>
|
||||||
experience: 0-2
|
experience: 0-2
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'contract'
|
||||||
|
skill_needs: 'javascript'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: false
|
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' %>
|
email: <%= CryptSerializer.dump 'peggy.blisters@mailinator.com' %>
|
||||||
experience: 0-2
|
experience: 0-2
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'contract'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: false
|
completed: false
|
||||||
@ -60,6 +70,8 @@ richard: # Richard has completed AND submitted the test
|
|||||||
email: <%= CryptSerializer.dump 'richard.burns@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'richard.burns@mailinator.com' %>
|
||||||
experience: 15+
|
experience: 15+
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
@ -73,6 +85,8 @@ juan: # Juan has chosen "finish later" for live coders
|
|||||||
email: <%= CryptSerializer.dump 'juan.campbell@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'juan.campbell@mailinator.com' %>
|
||||||
experience: 15+
|
experience: 15+
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: false
|
completed: false
|
||||||
@ -84,6 +98,8 @@ stacy: # Stacy has completed AND submitted the test
|
|||||||
email: <%= CryptSerializer.dump 'stacy.scott@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'stacy.scott@mailinator.com' %>
|
||||||
experience: 7-9
|
experience: 7-9
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
@ -97,6 +113,8 @@ henry: # Henry has completed AND submitted the test
|
|||||||
email: <%= CryptSerializer.dump 'henry.butler@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'henry.butler@mailinator.com' %>
|
||||||
experience: 4-6
|
experience: 4-6
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
@ -109,6 +127,8 @@ wade: # Wade has completed AND submitted the test
|
|||||||
email: <%= CryptSerializer.dump 'wade.armstrong@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'wade.armstrong@mailinator.com' %>
|
||||||
experience: 0-3
|
experience: 0-3
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
@ -121,6 +141,8 @@ jorge: # Jorge has completed AND submitted the test
|
|||||||
email: <%= CryptSerializer.dump 'jorge.holmes@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'jorge.holmes@mailinator.com' %>
|
||||||
experience: 0-3
|
experience: 0-3
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
@ -133,6 +155,8 @@ elsie: # Elsie has completed AND submitted the test
|
|||||||
email: <%= CryptSerializer.dump 'elsie.lowe@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'elsie.lowe@mailinator.com' %>
|
||||||
experience: 0-3
|
experience: 0-3
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'css/html'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: fed
|
quiz: fed
|
||||||
completed: true
|
completed: true
|
||||||
@ -145,6 +169,8 @@ gustov: # Gustov is NOT for FED
|
|||||||
email: <%= CryptSerializer.dump 'gustov@mailinator.com' %>
|
email: <%= CryptSerializer.dump 'gustov@mailinator.com' %>
|
||||||
experience: 0-3
|
experience: 0-3
|
||||||
project: Client/Project
|
project: Client/Project
|
||||||
|
position: 'full-time'
|
||||||
|
skill_needs: 'C#, SQL'
|
||||||
recruiter: recruiter
|
recruiter: recruiter
|
||||||
quiz: admin
|
quiz: admin
|
||||||
completed: false
|
completed: false
|
||||||
|
@ -18,6 +18,7 @@ class CandidateTest < ActiveSupport::TestCase
|
|||||||
email: email,
|
email: email,
|
||||||
experience: '0-3',
|
experience: '0-3',
|
||||||
project: 'Client',
|
project: 'Client',
|
||||||
|
position: 'full-time',
|
||||||
recruiter_id: users(:recruiter).id,
|
recruiter_id: users(:recruiter).id,
|
||||||
quiz_id: quizzes(:fed).id)
|
quiz_id: quizzes(:fed).id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user