notify manager email
This commit is contained in:
@ -12,4 +12,11 @@ class ReviewerMailer < ApplicationMailer
|
||||
|
||||
mail to: reminder.email, subject: "Review Reminder"
|
||||
end
|
||||
|
||||
def notify_manager candidate_id
|
||||
@candidate = Candidate.find_by(id: candidate_id)
|
||||
@manager = @candidate.manager
|
||||
|
||||
mail to: @manager.email, subject: "Voting Complete"
|
||||
end
|
||||
end
|
||||
|
@ -35,6 +35,13 @@ class Candidate < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def manager
|
||||
manager_votes = votes.joins(:user).where("users.role = 'manager'")
|
||||
return nil if manager_votes.empty?
|
||||
|
||||
manager_votes.first.user
|
||||
end
|
||||
|
||||
def submitted_answers
|
||||
answers.where(submitted: true)
|
||||
end
|
||||
|
Reference in New Issue
Block a user