module Employee

Public Instance Methods

add_assistant!(new_assistant) click to toggle source
# File lib/buweb/concerns/employee.rb, line 45
def add_assistant!(new_assistant)
  self.assistants << new_assistant
  self.save
end
additional_titles_string() click to toggle source
# File lib/buweb/concerns/employee.rb, line 37
def additional_titles_string
  self.additional_titles.join('| ') if additional_titles.present?
end
additional_titles_string=(string) click to toggle source

TODO: Adam wants this changed to be in the controllers

# File lib/buweb/concerns/employee.rb, line 51
def additional_titles_string=(string)
  self.additional_titles = string.to_s.split('|').map(&:strip)
end
assistant_to() click to toggle source
# File lib/buweb/concerns/employee.rb, line 41
def assistant_to
  Person.where(assistant_ids: self.id)
end
best_biola_title() click to toggle source
# File lib/buweb/concerns/employee.rb, line 29
def best_biola_title
  friendly_biola_title.presence || biola_title
end
department_title() click to toggle source
# File lib/buweb/concerns/employee.rb, line 55
def department_title
  departments.first.try(:title) || department
end
preferred_biola_email() click to toggle source
# File lib/buweb/concerns/employee.rb, line 33
def preferred_biola_email
  (use_work_email? && work_email.present?) ? work_email : biola_email
end
titles() click to toggle source
# File lib/buweb/concerns/employee.rb, line 24
def titles
  # .presence will turn empty strings into nil.
  [friendly_biola_title.presence || biola_title.presence].compact + additional_titles.to_a
end