policies and auto review builds
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
module Admin
|
||||
class VoteController < AdminController
|
||||
def up
|
||||
authorize ReviewerVote
|
||||
@candidate = Candidate.find_by(test_hash: params[:test_hash])
|
||||
authorize ReviewerVote.find_by(user_id: current_user.id, candidate_id: @candidate.id)
|
||||
current_user.cast_yea_on(@candidate)
|
||||
|
||||
results = {
|
||||
@ -16,8 +16,8 @@ module Admin
|
||||
end
|
||||
|
||||
def down
|
||||
authorize ReviewerVote
|
||||
@candidate = Candidate.find_by(test_hash: params[:test_hash])
|
||||
authorize ReviewerVote.find_by(user_id: current_user.id, candidate_id: @candidate.id)
|
||||
current_user.cast_nay_on(@candidate)
|
||||
|
||||
results = {
|
||||
@ -30,8 +30,8 @@ module Admin
|
||||
end
|
||||
|
||||
def approve
|
||||
authorize ReviewerVote
|
||||
@candidate = Candidate.find_by(test_hash: params[:test_hash])
|
||||
authorize ReviewerVote.find_by(user_id: current_user.id, candidate_id: @candidate.id)
|
||||
current_user.approve_candidate(@candidate)
|
||||
|
||||
results = {
|
||||
@ -43,8 +43,8 @@ module Admin
|
||||
end
|
||||
|
||||
def decline
|
||||
authorize ReviewerVote
|
||||
@candidate = Candidate.find_by(test_hash: params[:test_hash])
|
||||
authorize ReviewerVote.find_by(user_id: current_user.id, candidate_id: @candidate.id)
|
||||
current_user.decline_candidate(@candidate)
|
||||
|
||||
results = {
|
||||
|
@ -36,6 +36,7 @@ class QuizController < ApplicationController
|
||||
|
||||
def complete_and_email
|
||||
if current_candidate.update_attributes(completed: true)
|
||||
current_candidate.build_reviews
|
||||
CandidateMailer.submitted(current_candidate).deliver_later
|
||||
RecruiterMailer.candidate_submitted(current_candidate).deliver_later
|
||||
ReviewerMailer.candidate_submission(current_candidate).deliver_later
|
||||
|
Reference in New Issue
Block a user