diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 75d08ac..74423a3 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -14,11 +14,14 @@ module EventsHelper end.join(', ').html_safe end - def participant_names_or_emails(event) + def participant_names_with_emails(event) event.participants.map do |participant| - participant.try(:personal_profile, current_conference).try(:name) || - participant.personal_profiles.last.try(:name) || + if participant.personal_profile(event.conference).present? + profile = participant.personal_profile(event.conference) + "#{profile.name} <#{participant.email}>" + else participant.email + end end end end diff --git a/app/views/management/events/index.csv.erb b/app/views/management/events/index.csv.erb index 1a04c93..fd2e0c9 100644 --- a/app/views/management/events/index.csv.erb +++ b/app/views/management/events/index.csv.erb @@ -1,5 +1,5 @@ <%- csv_headers = %w{id title subtitle type track language paticipants status} -%> <%= CSV.generate_line(csv_headers).html_safe -%> <%- @events.each do |event| -%> - <%= CSV.generate_line([event.id, event.title, event.subtitle, event.event_type.name, event.track.name, event.language, participant_names_or_emails(event).join(', '), event.status]).html_safe -%> + <%= CSV.generate_line([event.id, event.title, event.subtitle, event.event_type.name, event.track.name, event.language, participant_names_with_emails(event).join(', '), event.status]).html_safe -%> <%- end -%>