linked into views
This commit is contained in:
		| @@ -77,10 +77,14 @@ There are some convenience scripts included to make starting the container and r | |||||||
| * `./start-server.sh` | * `./start-server.sh` | ||||||
|     - starts up just rails server for viewing application |     - 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 | ## TODOs and notes | ||||||
|  |  | ||||||
| * Question attachment path: http://dev.perficientxd.com/skill_assets/ | * Question attachment path: https://dev.perficientdigital.com/skills-app-images/ | ||||||
| * clean code | * clean code | ||||||
|     * [Confident Ruby](http://www.confidentruby.com/) |     * [Confident Ruby](http://www.confidentruby.com/) | ||||||
|     * [POODR](http://www.poodr.com/) |     * [POODR](http://www.poodr.com/) | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								app/assets/images/thumb-down-red.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								app/assets/images/thumb-down-red.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 311 B | 
							
								
								
									
										
											BIN
										
									
								
								app/assets/images/thumb-down.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								app/assets/images/thumb-down.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 282 B | 
							
								
								
									
										
											BIN
										
									
								
								app/assets/images/thumb-up-green.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								app/assets/images/thumb-up-green.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 316 B | 
							
								
								
									
										
											BIN
										
									
								
								app/assets/images/thumb-up.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								app/assets/images/thumb-up.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 274 B | 
							
								
								
									
										12
									
								
								app/assets/stylesheets/molecules/_review_meta.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								app/assets/stylesheets/molecules/_review_meta.scss
									
									
									
									
									
										Normal 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; } | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -4,6 +4,7 @@ class Candidate < ApplicationRecord | |||||||
|   has_many :questions, -> { order("sort") }, through: :quiz |   has_many :questions, -> { order("sort") }, through: :quiz | ||||||
|   has_many :answers |   has_many :answers | ||||||
|   belongs_to :recruiter, class_name: "User" |   belongs_to :recruiter, class_name: "User" | ||||||
|  |   has_many :votes, class_name: "ReviewerVote" | ||||||
|  |  | ||||||
|   serialize :email, CryptSerializer |   serialize :email, CryptSerializer | ||||||
|  |  | ||||||
| @@ -15,6 +16,12 @@ class Candidate < ApplicationRecord | |||||||
|   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 | ||||||
|  |  | ||||||
|  |   enum review_status: { | ||||||
|  |     # pending: 0, | ||||||
|  |     approved: 1, | ||||||
|  |     declined: 2 | ||||||
|  |   } | ||||||
|  |  | ||||||
|   def submitted_answers |   def submitted_answers | ||||||
|     answers.where(submitted: true) |     answers.where(submitted: true) | ||||||
|   end |   end | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| # frozen_string_literal: true | # frozen_string_literal: true | ||||||
| class ReviewerVote < ApplicationRecord | class ReviewerVote < ApplicationRecord | ||||||
|   # validates :user_id, uniqueness: {scope: :friend_id} |  | ||||||
|  |  | ||||||
|   belongs_to :candidate |   belongs_to :candidate | ||||||
|   belongs_to :user |   belongs_to :user | ||||||
|  |  | ||||||
|  |   validates :user_id, uniqueness: { scope: :candidate_id } | ||||||
|  |  | ||||||
|   enum vote: { |   enum vote: { | ||||||
|     undecided: 0, |     undecided: 0, | ||||||
|     yea: 1, |     yea: 1, | ||||||
|   | |||||||
| @@ -15,6 +15,7 @@ | |||||||
|       <th>Progress</th> |       <th>Progress</th> | ||||||
|       <th>Completed</th> |       <th>Completed</th> | ||||||
|       <th>Reminded</th> |       <th>Reminded</th> | ||||||
|  |       <th>Review Status</th> | ||||||
|     </tr> |     </tr> | ||||||
|  |  | ||||||
|     <% @candidates.each do |candidate| %> |     <% @candidates.each do |candidate| %> | ||||||
| @@ -28,8 +29,9 @@ | |||||||
|         </td> |         </td> | ||||||
|         <td><%= candidate.experience %> years</td> |         <td><%= candidate.experience %> years</td> | ||||||
|         <td><%= candidate.status %></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.reminded ? "Yes" : "" %></td> | ||||||
|  |         <td><%= candidate.review_status %></td> | ||||||
|       </tr> |       </tr> | ||||||
|     <% end %> |     <% end %> | ||||||
|   </table> |   </table> | ||||||
|   | |||||||
| @@ -1,10 +1,33 @@ | |||||||
| <main class="summary_tpl"> | <main class="summary_tpl"> | ||||||
|   <h2 class="prft-heading">Quiz Review</h2> |   <h2 class="prft-heading">Quiz Review</h2> | ||||||
|   <p> |  | ||||||
|     <strong>Test ID:</strong> <%= @candidate.test_hash %><br /> |   <div class="review_meta"> | ||||||
|     <strong>Years of Experience:</strong> <%= @candidate.experience %><br /> |     <div> | ||||||
|     <strong>Recruiter Email:</strong> <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %><br /> |       <strong>Test ID:</strong> <%= @candidate.test_hash %><br /> | ||||||
|   </p> |       <strong>Years of Experience:</strong> <%= @candidate.experience %><br /> | ||||||
|  |       <strong>Recruiter Email:</strong> <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %><br /> | ||||||
|  |     </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| %> |   <% @quiz.each do |question| %> | ||||||
|     <%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %> |     <%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %> | ||||||
|   | |||||||
							
								
								
									
										40
									
								
								test/fixtures/answers.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										40
									
								
								test/fixtures/answers.yml
									
									
									
									
										vendored
									
									
								
							| @@ -599,8 +599,8 @@ henry10: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 40.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 40.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 20.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 20.minutes %> | ||||||
|  |  | ||||||
| martin1: | wade1: | ||||||
|   candidate: martin |   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. |   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 |   answer: option 3 | ||||||
|   saved: 0 |   saved: 0 | ||||||
| @@ -608,8 +608,8 @@ martin1: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 22.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 22.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 22.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 22.minutes %> | ||||||
|  |  | ||||||
| martin2: | wade2: | ||||||
|   candidate: martin |   candidate: wade | ||||||
|   question: fed2 |   question: fed2 | ||||||
|   answer: 'indexOf()' |   answer: 'indexOf()' | ||||||
|   saved: 0 |   saved: 0 | ||||||
| @@ -617,8 +617,8 @@ martin2: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 24.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 24.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 4.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 4.minutes %> | ||||||
|  |  | ||||||
| martin3: | wade3: | ||||||
|   candidate: martin |   candidate: wade | ||||||
|   question: fed3 |   question: fed3 | ||||||
|   answer: {html: '<h1>Salmon</h1>', css: 'h1 {color: salmon;}', js: '', text: 'Gotta lotta GOOD things on sale, strangah.'} |   answer: {html: '<h1>Salmon</h1>', css: 'h1 {color: salmon;}', js: '', text: 'Gotta lotta GOOD things on sale, strangah.'} | ||||||
|   saved: 0 |   saved: 0 | ||||||
| @@ -626,8 +626,8 @@ martin3: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 26.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 26.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 6.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 6.minutes %> | ||||||
|  |  | ||||||
| martin4: | wade4: | ||||||
|   candidate: martin |   candidate: wade | ||||||
|   question: fed4 |   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. |   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 |   saved: 0 | ||||||
| @@ -635,8 +635,8 @@ martin4: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 28.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 28.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 28.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 28.minutes %> | ||||||
|  |  | ||||||
| martin5: | wade5: | ||||||
|   candidate: martin |   candidate: wade | ||||||
|   question: fed5 |   question: fed5 | ||||||
|   answer: 'Dynamic listeners' |   answer: 'Dynamic listeners' | ||||||
|   saved: 0 |   saved: 0 | ||||||
| @@ -644,8 +644,8 @@ martin5: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 30.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 30.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 30.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 30.minutes %> | ||||||
|  |  | ||||||
| martin6: | wade6: | ||||||
|   candidate: martin |   candidate: wade | ||||||
|   question: fed6 |   question: fed6 | ||||||
|   answer: Integer posuere erat a ante venenatis dapibus posuere velit aliquet. |   answer: Integer posuere erat a ante venenatis dapibus posuere velit aliquet. | ||||||
|   saved: 0 |   saved: 0 | ||||||
| @@ -653,8 +653,8 @@ martin6: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 32.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 32.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 12.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 12.minutes %> | ||||||
|  |  | ||||||
| martin7: | wade7: | ||||||
|   candidate: martin |   candidate: wade | ||||||
|   question: fed7 |   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");'} |   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 |   saved: 0 | ||||||
| @@ -662,8 +662,8 @@ martin7: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 34.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 34.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 14.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 14.minutes %> | ||||||
|  |  | ||||||
| martin8: | wade8: | ||||||
|   candidate: martin |   candidate: wade | ||||||
|   question: fed8 |   question: fed8 | ||||||
|   answer: |   answer: | ||||||
|     other: Some generic user input |     other: Some generic user input | ||||||
| @@ -674,8 +674,8 @@ martin8: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 36.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 36.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 16.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 16.minutes %> | ||||||
|  |  | ||||||
| martin9: | wade9: | ||||||
|   candidate: martin |   candidate: wade | ||||||
|   question: fed9 |   question: fed9 | ||||||
|   answer: |   answer: | ||||||
|     other: Brunch |     other: Brunch | ||||||
| @@ -687,8 +687,8 @@ martin9: | |||||||
|   created_at: <%= DateTime.now() - 36.hours - 38.minutes %> |   created_at: <%= DateTime.now() - 36.hours - 38.minutes %> | ||||||
|   updated_at: <%= DateTime.now() - 36.hours - 18.minutes %> |   updated_at: <%= DateTime.now() - 36.hours - 18.minutes %> | ||||||
|  |  | ||||||
| martin10: | wade10: | ||||||
|   candidate: martin |   candidate: wade | ||||||
|   question: fed10 |   question: fed10 | ||||||
|   answer: ["Live long and prosper", "Who you calling Scruffy?"] |   answer: ["Live long and prosper", "Who you calling Scruffy?"] | ||||||
|   saved: 0 |   saved: 0 | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								test/fixtures/candidates.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								test/fixtures/candidates.yml
									
									
									
									
										vendored
									
									
								
							| @@ -59,6 +59,7 @@ richard: # Richard has completed AND submitted the test | |||||||
|   completed: true |   completed: true | ||||||
|   reminded: false |   reminded: false | ||||||
|   test_hash: 6NjnourLE6Y |   test_hash: 6NjnourLE6Y | ||||||
|  |   review_status: 1 | ||||||
|  |  | ||||||
| juan: # Juan has chosen "finish later" for live coders | juan: # Juan has chosen "finish later" for live coders | ||||||
|   name: Juan Campbell |   name: Juan Campbell | ||||||
| @@ -79,6 +80,7 @@ stacy: # Stacy has completed AND submitted the test | |||||||
|   completed: true |   completed: true | ||||||
|   reminded: false |   reminded: false | ||||||
|   test_hash: s6oFExZliYYFx |   test_hash: s6oFExZliYYFx | ||||||
|  |   review_status: 2 | ||||||
|  |  | ||||||
| henry: # Henry has completed AND submitted the test | henry: # Henry has completed AND submitted the test | ||||||
|   name: Henry Butler |   name: Henry Butler | ||||||
| @@ -98,5 +100,5 @@ wade: # Wade has completed AND submitted the test | |||||||
|   quiz: fed |   quiz: fed | ||||||
|   completed: true |   completed: true | ||||||
|   reminded: false |   reminded: false | ||||||
|   test_hash: BkSkpa/pJnkz2N |   test_hash: BkSkpapJnkz2N | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								test/fixtures/questions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								test/fixtures/questions.yml
									
									
									
									
										vendored
									
									
								
							| @@ -55,7 +55,7 @@ fed5: | |||||||
| fed6: | fed6: | ||||||
|   quiz: fed |   quiz: fed | ||||||
|   question: Comment on how realistic the following image is. |   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 |   category: CSS | ||||||
|   input_type: text |   input_type: text | ||||||
|   input_options: |   input_options: | ||||||
|   | |||||||
| @@ -5,4 +5,30 @@ class ReviewerVoteTest < ActiveSupport::TestCase | |||||||
|   test "the truth" do |   test "the truth" do | ||||||
|     assert ReviewerVoteTest |     assert ReviewerVoteTest | ||||||
|   end |   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 | end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user