forked from railsbridge/bridge_troll
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create security list, Rename attendee names and student details
Fixes railsbridge#449 * Removed download attendee button from organizer tools index * Allow event organizers to download a list of student names * Renamed security_list to student_names * Fixed Download basic student info test
- Loading branch information
1 parent
c601fe3
commit 5c87b60
Showing
5 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require "csv" | ||
|
||
class Events::AttendeeNamesController < ApplicationController | ||
before_action :authenticate_user! | ||
before_action :find_event | ||
|
||
def index | ||
authorize @event, :edit? | ||
|
||
rsvps = @event.rsvps.where(role_id: Role.attendee_role_ids_with_organizers) | ||
|
||
respond_to do |format| | ||
format.csv do | ||
send_data(attendee_csv_data(rsvps), type: :csv) | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def find_event | ||
@event = Event.find_by_id(params[:event_id]) | ||
end | ||
|
||
def attendee_csv_data(rsvps) | ||
CSV.generate do |csv| | ||
csv << ['Last Name', 'First Name'] | ||
|
||
rsvps.includes(:user).joins(:bridgetroll_user).order('users.last_name ASC, users.first_name ASC').each do |rsvp| | ||
csv << [rsvp.user.last_name, rsvp.user.first_name] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters