include questions in registrations pdf and xls
This commit is contained in:
parent
3b8b86eb85
commit
ef96da7144
2 changed files with 48 additions and 38 deletions
|
|
@ -1,34 +1,37 @@
|
|||
prawn_document(:force_download=>true, :filename => @pdf_filename) do |pdf|
|
||||
prawn_document(force_download: true, filename: @pdf_filename, page_layout: :landscape) do |pdf|
|
||||
table_array = []
|
||||
header_array = [" ",
|
||||
"Name",
|
||||
"Email",
|
||||
"Attending Social Events",
|
||||
"Attending With Partner",
|
||||
"Arrival Date",
|
||||
"Departure Date"]
|
||||
header_array = ['Attended',
|
||||
'Name',
|
||||
'Nickname',
|
||||
'Affiliation',
|
||||
'Email',
|
||||
'Arrival Date',
|
||||
'Departure Date']
|
||||
@conference.questions.each do |question|
|
||||
header_array << question.title
|
||||
end
|
||||
|
||||
table_array << header_array
|
||||
@registrations.each do |registration|
|
||||
row = []
|
||||
row << ""
|
||||
row << ( registration.attended ? 'X' : '' )
|
||||
row << registration.name
|
||||
row << registration.nickname
|
||||
row << registration.affiliation
|
||||
row << registration.email
|
||||
if registration.attending_social_events
|
||||
row << "X"
|
||||
else
|
||||
row << " "
|
||||
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
|
||||
|
||||
if registration.attending_with_partner.to_s
|
||||
row << "X"
|
||||
else
|
||||
row << " "
|
||||
end
|
||||
row << registration.arrival.to_s
|
||||
row << registration.departure.to_s
|
||||
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}
|
||||
pdf.text "#{@conference.title} Registrations", font_size: 25
|
||||
pdf.table table_array, header: true, cell_style: {size: 5, border_width: 1}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue