osem-fcy/app/views/admin/registrations/index.pdf.prawn
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

33 lines
962 B
Ruby

prawn_document(force_download: true, filename: @pdf_filename, page_layout: :landscape) do |pdf|
table_array = []
header_array = ['Attended',
'Name',
'Nickname',
'Affiliation',
'Email']
@conference.questions.each do |question|
header_array << question.title
end
table_array << header_array
@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
table_array << row
end
pdf.text "#{@conference.title} Registrations", font_size: 25
pdf.table table_array, header: true, cell_style: {size: 5, border_width: 1}
end