Merge pull request #1169 from nishanthvijayan/reports

Add new page with organizer reports
This commit is contained in:
Stella Rouzi 2017-01-15 12:28:38 +02:00 committed by GitHub
commit 46101228e7
4 changed files with 143 additions and 1 deletions

View file

@ -5,7 +5,7 @@ module Admin
load_and_authorize_resource :event, through: :program
load_and_authorize_resource :events_registration, only: :toggle_attendance
before_action :get_event, except: [:index, :create]
before_action :get_event, except: [:index, :create, :reports]
# FIXME: The timezome should only be applied on output, otherwise
# you get lost in timezone conversions...
@ -150,6 +150,17 @@ module Admin
end
end
def reports
@events = @program.events
@events_commercials = Commercial.where(commercialable_type: 'Event', commercialable_id: @events.pluck(:id))
@events_missing_commercial = @events.where.not(id: @events_commercials.pluck(:commercialable_id))
@events_with_requirements = @events.where.not(description: ['', nil])
attended_registrants_ids = @conference.registrations.where(attended: true).pluck(:user_id)
@missing_event_speakers = EventUser.joins(:event).where('event_role = ? and program_id = ?', 'submitter', @program.id).
where.not(user_id: attended_registrants_ids).includes(:user, :event)
end
private
def event_params