2018-05-07 16:47:29 -07:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
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)
|
2018-12-29 15:36:17 -08:00
|
|
|
|
row = ['Attended', 'Name', 'Nickname', 'Affilιation', 'Email']
|
2015-04-23 12:07:11 +03:00
|
|
|
|
|
|
|
|
|
|
@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
|
|
|
|
|
|
@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
|