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:
parent
754d201b01
commit
fa55224163
26 changed files with 181 additions and 165 deletions
|
|
@ -1,30 +1,27 @@
|
|||
- cache [conference, conference.call_for_events, conference.confirmed_tracks,
|
||||
'#splash#callforpapers'] do
|
||||
- cache [conference_id, call, event_types, tracks, '#splash#callforpapers'] do
|
||||
.col-md-5.col-sm-5.text-center
|
||||
%h2
|
||||
Call for Papers
|
||||
%p.lead
|
||||
We are now accepting proposals for sessions!
|
||||
%p
|
||||
- if conference.event_types.any?
|
||||
- if event_types.any?
|
||||
You can submit proposals for
|
||||
%span.notranslate
|
||||
= event_types(conference) + '.'
|
||||
- if conference.confirmed_tracks.any?
|
||||
= event_types.map(&:pluralize).to_sentence + '.'
|
||||
- if tracks.any?
|
||||
Proposals should fit in one of the
|
||||
%span.notranslate
|
||||
= pluralize(conference.confirmed_tracks.length, 'track') + ':'
|
||||
= tracks(conference) + '.'
|
||||
- if conference.call_for_events.try(:open?)
|
||||
The submission period is open
|
||||
%em.notranslate
|
||||
= date_string(conference.call_for_events.start_date,
|
||||
conference.call_for_events.end_date) + '.'
|
||||
%b
|
||||
You have
|
||||
= pluralize(conference.call_for_events.remaining_days, 'day')
|
||||
left!
|
||||
= pluralize(tracks.length, 'track') + ':'
|
||||
= tracks.to_sentence + '.'
|
||||
The submission period is open
|
||||
%em.notranslate
|
||||
= date_string(call.start_date, call.end_date) + '.'
|
||||
%b
|
||||
You have
|
||||
= pluralize(call.remaining_days, 'day')
|
||||
left!
|
||||
%p.cta-button
|
||||
= link_to "Submit your proposal now",
|
||||
conference_program_proposals_path(conference.short_title),
|
||||
conference_program_proposals_path(conference_id),
|
||||
class: 'btn btn-success btn-lg text-center'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue