2013-07-16 09:47:23 +02:00
|
|
|
|
wb = xlsx_package.workbook
|
2015-04-23 12:07:11 +03:00
|
|
|
|
wb.add_worksheet(name: 'registrations') do |sheet|
|
|
|
|
|
|
bold_style = wb.styles.add_style(b: true)
|
|
|
|
|
|
row = ['Attended', 'Name', 'Nickname', 'Affilιation', 'Email', 'Arrival', 'Departure']
|
|
|
|
|
|
|
|
|
|
|
|
@conference.questions.each do |question|
|
|
|
|
|
|
row << question.title
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2013-07-16 09:47:23 +02:00
|
|
|
|
sheet.add_row row, :style => bold_style
|
|
|
|
|
|
|
2015-04-23 12:07:11 +03:00
|
|
|
|
@registrations.each do |registration|
|
2013-07-16 09:47:23 +02:00
|
|
|
|
row = []
|
2015-04-23 12:07:11 +03:00
|
|
|
|
row << ( registration.attended ? 'X' : '' )
|
|
|
|
|
|
row << registration.name
|
|
|
|
|
|
row << registration.nickname
|
|
|
|
|
|
row << registration.affiliation
|
|
|
|
|
|
row << registration.email
|
|
|
|
|
|
row << registration.arrival.to_s
|
|
|
|
|
|
row << registration.departure.to_s
|
|
|
|
|
|
@conference.questions.each do |question|
|
|
|
|
|
|
qa = registration.qanswers.find_by(question: question)
|
|
|
|
|
|
answer = ( qa ? qa.answer.title : '' )
|
|
|
|
|
|
|
|
|
|
|
|
row << answer
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2013-07-16 09:47:23 +02:00
|
|
|
|
sheet.add_row row
|
|
|
|
|
|
end
|
2014-06-23 19:07:50 +03:00
|
|
|
|
end
|
2013-07-16 09:47:23 +02:00
|
|
|
|
|