From bcb840c986a7c26db842e7e49645a2cb272fabe0 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Mon, 28 Nov 2016 15:40:25 -0600 Subject: [PATCH] completes #84 : interview request status tweaks --- app/models/candidate.rb | 5 ++++ app/views/admin/candidate/index.html.erb | 4 ++-- app/views/admin/result/_voting.html.erb | 29 +++++++++++++----------- app/views/admin/result/index.html.erb | 4 ++-- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/models/candidate.rb b/app/models/candidate.rb index f75a738..21e6ac8 100644 --- a/app/models/candidate.rb +++ b/app/models/candidate.rb @@ -23,6 +23,11 @@ class Candidate < ApplicationRecord declined: 2 } + def interview? + return 'yes' if approved? + 'no' if declined? + end + def build_reviews reviewers.each do |reviewer| votes.find_or_create_by(user_id: reviewer.id) diff --git a/app/views/admin/candidate/index.html.erb b/app/views/admin/candidate/index.html.erb index 67f464b..e2e2302 100644 --- a/app/views/admin/candidate/index.html.erb +++ b/app/views/admin/candidate/index.html.erb @@ -16,7 +16,7 @@ Progress Completed Reminded - Interview Request + Interview? <% @candidates.each do |candidate| %> @@ -32,7 +32,7 @@ <%= candidate.status %> <%= candidate.completed ? link_to("Submitted", admin_result_path(candidate.test_hash)) : "" %> <%= candidate.reminded ? "Yes" : "" %> - <%= candidate.review_status unless candidate.pending? %> + <%= candidate.interview? %> <% end %> diff --git a/app/views/admin/result/_voting.html.erb b/app/views/admin/result/_voting.html.erb index bc04725..3c89df9 100644 --- a/app/views/admin/result/_voting.html.erb +++ b/app/views/admin/result/_voting.html.erb @@ -1,4 +1,4 @@ -<% # TODO: This needs to be extracted into a decorator, or something. It is only a quick hack solution. %> +<% # TODO: This should be extracted into a decorator, or something. It is only a quick hack solution. %> <% if current_user.acts_as_reviewer? %>
@@ -15,19 +15,22 @@ <% if current_user.acts_as_manager? %>
- Manager Vetos: - <%= link_to admin_approve_vote_path(test_hash: @candidate.test_hash), remote: true do %> - - <%= @candidate.approved? ? "Requested" : "Request Interview" %> - - <% end %> - <%= link_to admin_decline_vote_path(test_hash: @candidate.test_hash), remote: true do %> - - <%= @candidate.declined? ? "Declined" : "Decline Interview" %> - - <% end %> -
+ Interview: + <% if !@candidate.approved? %> + <%= link_to admin_approve_vote_path(test_hash: @candidate.test_hash), remote: true do %> + Yes + <% end %> + <% else %>Yes<% end %> + + + <% if !@candidate.declined? %> + <%= link_to admin_decline_vote_path(test_hash: @candidate.test_hash), remote: true do %> + No + <% end %> + <% else %>No<% end %> + +
<% else %> Candidate Interview Status: <%= @candidate.review_status %> diff --git a/app/views/admin/result/index.html.erb b/app/views/admin/result/index.html.erb index 79ed6de..dd05923 100644 --- a/app/views/admin/result/index.html.erb +++ b/app/views/admin/result/index.html.erb @@ -8,7 +8,7 @@ Test ID Experience Recruiter - Interview Request + Interview? <% @candidates.each do |candidate| %> @@ -16,7 +16,7 @@ <%= link_to candidate.test_hash, admin_result_path(candidate.test_hash) %> <%= candidate.experience %> years <%= mail_to(candidate.recruiter.email) %> - <%= candidate.review_status unless candidate.pending? %> + <%= candidate.interview? %> <% end %>