diff --git a/README.md b/README.md
index 76b03dc..8d2f5e1 100644
--- a/README.md
+++ b/README.md
@@ -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/)
diff --git a/app/assets/images/thumb-down-red.png b/app/assets/images/thumb-down-red.png
new file mode 100644
index 0000000..13c46e7
Binary files /dev/null and b/app/assets/images/thumb-down-red.png differ
diff --git a/app/assets/images/thumb-down.png b/app/assets/images/thumb-down.png
new file mode 100644
index 0000000..9cd2fb3
Binary files /dev/null and b/app/assets/images/thumb-down.png differ
diff --git a/app/assets/images/thumb-up-green.png b/app/assets/images/thumb-up-green.png
new file mode 100644
index 0000000..272a9b5
Binary files /dev/null and b/app/assets/images/thumb-up-green.png differ
diff --git a/app/assets/images/thumb-up.png b/app/assets/images/thumb-up.png
new file mode 100644
index 0000000..930eb04
Binary files /dev/null and b/app/assets/images/thumb-up.png differ
diff --git a/app/assets/stylesheets/molecules/_review_meta.scss b/app/assets/stylesheets/molecules/_review_meta.scss
new file mode 100644
index 0000000..31b60ee
--- /dev/null
+++ b/app/assets/stylesheets/molecules/_review_meta.scss
@@ -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; }
+ }
+}
diff --git a/app/models/candidate.rb b/app/models/candidate.rb
index a216c37..dac22db 100644
--- a/app/models/candidate.rb
+++ b/app/models/candidate.rb
@@ -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
diff --git a/app/models/reviewer_vote.rb b/app/models/reviewer_vote.rb
index 8f52019..6ed8fce 100644
--- a/app/models/reviewer_vote.rb
+++ b/app/models/reviewer_vote.rb
@@ -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,
diff --git a/app/views/admin/candidate/index.html.erb b/app/views/admin/candidate/index.html.erb
index 130c99e..d4ababd 100644
--- a/app/views/admin/candidate/index.html.erb
+++ b/app/views/admin/candidate/index.html.erb
@@ -15,6 +15,7 @@
Progress |
Completed |
Reminded |
+ Review Status |
<% @candidates.each do |candidate| %>
@@ -28,8 +29,9 @@
<%= candidate.experience %> years |
<%= candidate.status %> |
- <%= candidate.completed ? "Submitted" : "" %> |
+ <%= candidate.completed ? link_to("Submitted", admin_result_path(candidate.test_hash)) : "" %> |
<%= candidate.reminded ? "Yes" : "" %> |
+ <%= candidate.review_status %> |
<% end %>
diff --git a/app/views/admin/result/view.html.erb b/app/views/admin/result/view.html.erb
index 73a0f72..10f1458 100644
--- a/app/views/admin/result/view.html.erb
+++ b/app/views/admin/result/view.html.erb
@@ -1,10 +1,33 @@
Quiz Review
-
- Test ID: <%= @candidate.test_hash %>
- Years of Experience: <%= @candidate.experience %>
- Recruiter Email: <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %>
-
+
+
<% @quiz.each do |question| %>
<%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %>
diff --git a/test/fixtures/answers.yml b/test/fixtures/answers.yml
index feda3fa..de70e0c 100644
--- a/test/fixtures/answers.yml
+++ b/test/fixtures/answers.yml
@@ -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: 'Salmon
', 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: 'This means jQuery needs to be available in live-coder!
', 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
diff --git a/test/fixtures/candidates.yml b/test/fixtures/candidates.yml
index 237c23a..7a22bfd 100644
--- a/test/fixtures/candidates.yml
+++ b/test/fixtures/candidates.yml
@@ -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
diff --git a/test/fixtures/questions.yml b/test/fixtures/questions.yml
index 97c7d00..4380750 100644
--- a/test/fixtures/questions.yml
+++ b/test/fixtures/questions.yml
@@ -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:
diff --git a/test/models/reviewer_vote_test.rb b/test/models/reviewer_vote_test.rb
index 1ce2161..48db0fe 100644
--- a/test/models/reviewer_vote_test.rb
+++ b/test/models/reviewer_vote_test.rb
@@ -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