1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-17 05:15:36 +00:00

Fixed a couple slow queries

This commit is contained in:
2021-12-11 03:08:43 +00:00
parent 5ef27f19cc
commit 8430949a37
6 changed files with 15 additions and 10 deletions

View File

@@ -174,12 +174,14 @@ class TournamentsController < ApplicationController
def all_brackets
@schools = @tournament.schools
@schools = @schools.sort_by{|s| s.page_score_string}.reverse!
@matches = @tournament.matches.includes(:wrestlers,:schools)
@weights = @tournament.weights.includes(:matches,:wrestlers)
end
def bracket
if params[:weight]
@weight = Weight.where(:id => params[:weight]).includes(:matches,:wrestlers).first
@matches = @weight.matches
@matches = @weight.matches.includes(:schools,:wrestlers)
@wrestlers = @weight.wrestlers.includes(:school)
if @tournament.tournament_type == "Pool to bracket"
@pools = @weight.pool_rounds(@matches)