linked into views

This commit is contained in:
Mark Moser 2016-11-18 17:43:24 -06:00 committed by Mark Moser
parent 37aa17ec1f
commit 5845f76e1d
14 changed files with 107 additions and 31 deletions

View File

@ -77,10 +77,14 @@ There are some convenience scripts included to make starting the container and r
* `./start-server.sh`
- starts up just rails server for viewing application
## Deploying a new version
* ssh into server
* cd into app root
* run deploy.sh
## TODOs and notes
* Question attachment path: http://dev.perficientxd.com/skill_assets/
* Question attachment path: https://dev.perficientdigital.com/skills-app-images/
* clean code
* [Confident Ruby](http://www.confidentruby.com/)
* [POODR](http://www.poodr.com/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

View File

@ -0,0 +1,12 @@
.review_meta {
@media screen and (min-width: 768px) {
display: flex;
& > div { flex: 1 1 auto; }
}
.review_meta__votes,
.review_meta__vetos {
a { padding: 5px; }
}
}

View File

@ -4,6 +4,7 @@ class Candidate < ApplicationRecord
has_many :questions, -> { order("sort") }, through: :quiz
has_many :answers
belongs_to :recruiter, class_name: "User"
has_many :votes, class_name: "ReviewerVote"
serialize :email, CryptSerializer
@ -15,6 +16,12 @@ class Candidate < ApplicationRecord
validates :email, uniqueness: true, presence: true, email_format: true
validates :test_hash, uniqueness: true, presence: true
enum review_status: {
# pending: 0,
approved: 1,
declined: 2
}
def submitted_answers
answers.where(submitted: true)
end

View File

@ -1,10 +1,10 @@
# frozen_string_literal: true
class ReviewerVote < ApplicationRecord
# validates :user_id, uniqueness: {scope: :friend_id}
belongs_to :candidate
belongs_to :user
validates :user_id, uniqueness: { scope: :candidate_id }
enum vote: {
undecided: 0,
yea: 1,

View File

@ -15,6 +15,7 @@
<th>Progress</th>
<th>Completed</th>
<th>Reminded</th>
<th>Review Status</th>
</tr>
<% @candidates.each do |candidate| %>
@ -28,8 +29,9 @@
</td>
<td><%= candidate.experience %> years</td>
<td><%= candidate.status %></td>
<td><%= candidate.completed ? "Submitted" : "" %></td>
<td><%= candidate.completed ? link_to("Submitted", admin_result_path(candidate.test_hash)) : "" %></td>
<td><%= candidate.reminded ? "Yes" : "" %></td>
<td><%= candidate.review_status %></td>
</tr>
<% end %>
</table>

View File

@ -1,10 +1,33 @@
<main class="summary_tpl">
<h2 class="prft-heading">Quiz Review</h2>
<p>
<div class="review_meta">
<div>
<strong>Test ID:</strong> <%= @candidate.test_hash %><br />
<strong>Years of Experience:</strong> <%= @candidate.experience %><br />
<strong>Recruiter Email:</strong> <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %><br />
</p>
</div>
<div>
<div class="review_meta__votes">
<strong>Votes: </strong>
<%= link_to '#cast-vote-up', remote: true do %>
Yea (<%= @candidate.votes.yea.count %>)
<% end %>
<%= link_to '#cast-vote-down', remote: true do %>
Nay (<%= @candidate.votes.nay.count %>)
<% end %>
</div>
<div class="review_meta__vetos">
<strong>Manager Vetos: </strong>
<%= link_to '#request', remote: true do %>
Request Interview
<% end %>
<%= link_to '#decline', remote: true do %>
Decline Interview
<% end %>
</div>
</div>
</div>
<% @quiz.each do |question| %>
<%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %>

View File

@ -599,8 +599,8 @@ henry10:
created_at: <%= DateTime.now() - 36.hours - 40.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 20.minutes %>
martin1:
candidate: martin
wade1:
candidate: wade
question: Cras justo odio, dapibus ac facilisis in, egestas eget quam. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit.
answer: option 3
saved: 0
@ -608,8 +608,8 @@ martin1:
created_at: <%= DateTime.now() - 36.hours - 22.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 22.minutes %>
martin2:
candidate: martin
wade2:
candidate: wade
question: fed2
answer: 'indexOf()'
saved: 0
@ -617,8 +617,8 @@ martin2:
created_at: <%= DateTime.now() - 36.hours - 24.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 4.minutes %>
martin3:
candidate: martin
wade3:
candidate: wade
question: fed3
answer: {html: '<h1>Salmon</h1>', css: 'h1 {color: salmon;}', js: '', text: 'Gotta lotta GOOD things on sale, strangah.'}
saved: 0
@ -626,8 +626,8 @@ martin3:
created_at: <%= DateTime.now() - 36.hours - 26.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 6.minutes %>
martin4:
candidate: martin
wade4:
candidate: wade
question: fed4
answer: Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
saved: 0
@ -635,8 +635,8 @@ martin4:
created_at: <%= DateTime.now() - 36.hours - 28.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 28.minutes %>
martin5:
candidate: martin
wade5:
candidate: wade
question: fed5
answer: 'Dynamic listeners'
saved: 0
@ -644,8 +644,8 @@ martin5:
created_at: <%= DateTime.now() - 36.hours - 30.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 30.minutes %>
martin6:
candidate: martin
wade6:
candidate: wade
question: fed6
answer: Integer posuere erat a ante venenatis dapibus posuere velit aliquet.
saved: 0
@ -653,8 +653,8 @@ martin6:
created_at: <%= DateTime.now() - 36.hours - 32.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 12.minutes %>
martin7:
candidate: martin
wade7:
candidate: wade
question: fed7
answer: {html: '<p>This means <strong>jQuery</strong> needs to be available in live-coder!</p>', css: "strong {font-size: 1.6em;}\n.green {color: green;}", js: '$("strong").addClass("green");'}
saved: 0
@ -662,8 +662,8 @@ martin7:
created_at: <%= DateTime.now() - 36.hours - 34.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 14.minutes %>
martin8:
candidate: martin
wade8:
candidate: wade
question: fed8
answer:
other: Some generic user input
@ -674,8 +674,8 @@ martin8:
created_at: <%= DateTime.now() - 36.hours - 36.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 16.minutes %>
martin9:
candidate: martin
wade9:
candidate: wade
question: fed9
answer:
other: Brunch
@ -687,8 +687,8 @@ martin9:
created_at: <%= DateTime.now() - 36.hours - 38.minutes %>
updated_at: <%= DateTime.now() - 36.hours - 18.minutes %>
martin10:
candidate: martin
wade10:
candidate: wade
question: fed10
answer: ["Live long and prosper", "Who you calling Scruffy?"]
saved: 0

View File

@ -59,6 +59,7 @@ richard: # Richard has completed AND submitted the test
completed: true
reminded: false
test_hash: 6NjnourLE6Y
review_status: 1
juan: # Juan has chosen "finish later" for live coders
name: Juan Campbell
@ -79,6 +80,7 @@ stacy: # Stacy has completed AND submitted the test
completed: true
reminded: false
test_hash: s6oFExZliYYFx
review_status: 2
henry: # Henry has completed AND submitted the test
name: Henry Butler
@ -98,5 +100,5 @@ wade: # Wade has completed AND submitted the test
quiz: fed
completed: true
reminded: false
test_hash: BkSkpa/pJnkz2N
test_hash: BkSkpapJnkz2N

View File

@ -55,7 +55,7 @@ fed5:
fed6:
quiz: fed
question: Comment on how realistic the following image is.
attachment: "http://dev.perficientxd.com/skill_assets/commets_css.jpg"
attachment: "https://dev.perficientdigital.com/skills-app-images/commets_css.jpg"
category: CSS
input_type: text
input_options:

View File

@ -5,4 +5,30 @@ class ReviewerVoteTest < ActiveSupport::TestCase
test "the truth" do
assert ReviewerVoteTest
end
test "richard has 3 votes" do
richard = candidates(:richard)
assert_equal 3, richard.votes.size
end
test "manager has 4 votes" do
manager = users(:manager)
assert_equal 4, manager.votes.size
end
test "richard has been approved" do
richard = candidates(:richard)
assert richard.approved?
refute richard.declined?
end
test "stacy has been declined" do
stacy = candidates(:stacy)
assert stacy.declined?
refute stacy.approved?
end
end