mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 21:24:05 +00:00
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
|
||||
|
|
|
|||
|
|
@ -1,23 +1,30 @@
|
|||
wb = xlsx_package.workbook
|
||||
wb.add_worksheet(:name => "registrations") do |sheet|
|
||||
bold_style = wb.styles.add_style(:b => true)
|
||||
row = ["Attended", "Name", "Nickname", "Affilation", "Email", "Social events",
|
||||
"With partner", "Needs access", "Other needs", "Arrival", "Departure"]
|
||||
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
|
||||
|
||||
sheet.add_row row, :style => bold_style
|
||||
|
||||
@registrations.each do |reg|
|
||||
@registrations.each do |registration|
|
||||
row = []
|
||||
row << reg.attended
|
||||
row << reg.name
|
||||
row << reg.nickname
|
||||
row << reg.affiliation
|
||||
row << reg.email
|
||||
row << reg.attending_social_events
|
||||
row << reg.attending_with_partner
|
||||
row << reg.handicapped_access_required
|
||||
row << reg.other_needs
|
||||
row << reg.arrival
|
||||
row << reg.departure
|
||||
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
|
||||
|
||||
sheet.add_row row
|
||||
end
|
||||
sheet.column_info[8].width = [sheet.column_info[8].width, 30].min
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue