Break up the one-query-of-doom

The single query was producing a tremendously large ActiveRecord allocation.

While this isn't nearly as cool as one query, it's still a significant
reduction in SQL trips, and now has the bonus of only loading what is
actually going to be displayed.
This commit is contained in:
James Mason 2017-12-21 19:06:36 -08:00
parent 754d201b01
commit fa55224163
26 changed files with 181 additions and 165 deletions

View file

@ -12,35 +12,43 @@
#splash
-# header/description
= render 'header', conference: @conference
= render 'header', conference: @conference, venue: @conference.venue
-# calls for content, or program
- if @conference.splashpage.include_cfp
= render 'call_for_content', conference: @conference
= render 'call_for_content', conference: @conference,
call_for_events: @call_for_events, call_for_tracks: @call_for_tracks,
event_types: @event_types, tracks: @track_names
- if @conference.splashpage.include_program
= render 'program', conference: @conference
= render 'program', conference: @conference, tracks: @tracks,
highlights: @highlights, booths: @booths
-# attendance/registration
- if @conference.splashpage.include_registrations
- if @conference.registration_open?
= render 'registration', conference: @conference
= render 'registration', conference: @conference,
registration_period: @conference.registration_period,
tickets: @tickets, conference_id: @conference_id.short_title
- if @conference.splashpage.include_tickets && @conference.tickets.any?
= render 'tickets', conference: @conference
= render 'tickets', conference: @conference, tickets: @tickets
-# geo
- if @conference.splashpage.include_venue && @conference.venue
= render 'venue', conference: @conference
= render 'venue', conference: @conference, venue: @conference.venue,
commercial: @conference.venue.commercial
- if @conference.splashpage.include_lodgings && @conference.lodgings.any?
= render 'lodging', conference: @conference
= render 'lodging', venue: @conference.venue, lodgings: @lodgings
-# sponsorship
- if @conference.splashpage.include_sponsors
= render 'sponsors', conference: @conference
= render 'sponsors', conference: @conference,
sponsorship_levels: @sponsorship_levels
-# footer
- if @conference.splashpage.include_social_media
- if @conference.contact.has_social_media?
= render 'social_media', conference: @conference
= render 'social_media', contact: @conference.contact
= render 'footer'
= yield :modals