Fewer queries for for Conference#show

Reduces SQL wait times by >90% on splash pages.
This commit is contained in:
James Mason 2017-11-17 19:34:26 -08:00
parent 29a640a267
commit 995176ffe5
11 changed files with 122 additions and 99 deletions

View file

@ -7,7 +7,7 @@
= link_to(edit_user_path(current_user.id)) do
%span.fa.fa-user
Edit Profile
-if @conference and @conference.program
-if @conference && @conference.program
%li
= link_to(conference_program_proposals_path(@conference.short_title)) do
%span.fa.fa-comment
@ -16,7 +16,7 @@
= link_to(conference_program_tracks_path(@conference.short_title)) do
%span.fa.fa-road
My Tracks
-if @conference && @conference.program && (@conference.program.cfps.for_booths.try(:open?) || current_user.booths.where(conference_id: @conference.id).count > 0)
-if @conference && (@conference.call_for_booths.try(:open?) || current_user.booths.where(conference_id: @conference.id).count > 0)
%li
= link_to (conference_booths_path(@conference.short_title)) do
%span.fa.fa-shopping-bag
@ -41,7 +41,7 @@
=link_to(new_admin_conference_path) do
%span.fa.fa-plus
New Conference
-if @conference and @conference.id and can? :show, @conference
-if @conference && @conference.id && can?(:show, @conference)
%li
= link_to(admin_conference_path(@conference.short_title)) do
%span.fa.fa-cog