Move reports to separate controller

This commit is contained in:
Stella Rouzi 2017-03-03 15:45:06 +02:00
parent a325eccc77
commit 5e9bc683ae
9 changed files with 175 additions and 15 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, :reports]
before_action :get_event, except: [:index, :create]
# FIXME: The timezome should only be applied on output, otherwise
# you get lost in timezone conversions...
@ -152,17 +152,6 @@ 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