osem-fcy/app/views/admin/registrations/index.xlsx.axlsx
James Mason 7a04f3582f
Remove travel schedule from registration
(cherry picked from commit d18cc02f0185df39bb4213d8a63a955dfb433dcb)
Re: https://github.com/openSUSE/osem/issues/2333
2021-03-06 04:09:02 +01:00

30 lines
781 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# frozen_string_literal: true
wb = xlsx_package.workbook
wb.add_worksheet(name: 'registrations') do |sheet|
bold_style = wb.styles.add_style(b: true)
row = ['Attended', 'Name', 'Nickname', 'Affilιation', 'Email']
@conference.questions.each do |question|
row << question.title
end
sheet.add_row row, :style => bold_style
@registrations.each do |registration|
row = []
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
sheet.add_row row
end
end