Improve performance of admin/conference/*/registrations

* Add some caching
* Reduce query count, including N+1s on questions & roles
This commit is contained in:
James Mason 2018-04-06 10:21:22 -07:00
parent 6987c34e12
commit 66ea7c077d
No known key found for this signature in database
GPG key ID: 1B3951886C449023
5 changed files with 66 additions and 65 deletions

View file

@ -23,10 +23,8 @@ prawn_document(force_download: true, filename: @pdf_filename, page_layout: :land
row << registration.departure.to_s || ''
@conference.questions.each do |question|
qa = registration.qanswers.find_by(question: question)
answer = ( qa ? qa.answer.title : '' )
row << answer
qa = registration.qanswers.find{|qa| qa.question_id == question.id }
row << ( qa ? qa.answer.title : '' )
end
table_array << row