1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

trying to speed up brackets page

This commit is contained in:
2015-11-02 11:14:03 -05:00
parent 3734258e6c
commit 364ee21e3f
3 changed files with 10 additions and 10 deletions

View File

@@ -39,10 +39,10 @@ class StaticPagesController < ApplicationController
def brackets
if params[:weight]
@weight = Weight.find(params[:weight])
@weight = Weight.find(params[:weight]).includes(:matches,:wrestlers)
@tournament = Tournament.find(@weight.tournament_id)
@matches = @tournament.matches.select{|m| m.weight_id == @weight.id}
@wrestlers = Wrestler.where(weight_id: @weight.id).includes(:weight,:school)
@matches = @weight.matches
@wrestlers = @weight.wrestlers.includes(:school)
if @matches.empty? or @wrestlers.empty?
redirect_to "/static_pages/noMatches?tournament=#{@tournament.id}"
else