Add condition for missing_speakers in a track

A user should be able to see the missing speakers of
only those events that are accessible to him.

Fixes #1942
This commit is contained in:
Rishabh Singh 2019-03-16 14:50:40 +05:30
parent d4401cdd3c
commit 0785b5c7e0
2 changed files with 40 additions and 1 deletions

View file

@ -15,8 +15,9 @@ module Admin
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('event_role = ? and program_id = ?', 'speaker', @program.id)
.where.not(user_id: attended_registrants_ids)
.where(event_id: @events.pluck(:id))
.includes(:user, :event)
end
end