Allow scheduling volunteers for sessions.

Also fix a small bug for admin registrations edit.
This commit is contained in:
Michael Ball 2020-07-25 17:38:44 -07:00
parent b664639817
commit 8e1d03a318
12 changed files with 110 additions and 31 deletions

View file

@ -256,6 +256,12 @@ class User < ApplicationRecord
result
end
# TODO: Use a real authorization in the right place....
def manages_volunteers?(conference)
organizer_roles = get_roles['organizer']
organizer_roles&.include?(conference.short_title) # TODO or Volunteer Coorinator.
end
def registered
registrations = self.registrations
if registrations.count == 0
@ -290,6 +296,11 @@ class User < ApplicationRecord
proposals(conference).count
end
def volunteer_duties(conference)
events.where(program_id: conference.program.id, 'event_users.event_role': 'volunteer')
end
def self.empty?
User.count == 1 && User.first.email == 'deleted@localhost.osem'
end