mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Trying to increase speed of up_matches
This commit is contained in:
@@ -2,15 +2,15 @@ class StaticPagesController < ApplicationController
|
||||
before_filter :check_access, only: [:createCustomWeights,:generate_matches,:weigh_in]
|
||||
|
||||
def tournaments
|
||||
@tournaments = Tournament.all.includes(:user)
|
||||
@tournaments = Tournament.all.includes(:user,:matches,:mats)
|
||||
end
|
||||
def up_matches
|
||||
if params[:tournament]
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
end
|
||||
if @tournament
|
||||
@matches = @tournament.matches.where(mat_id: nil).order('bout_number ASC').limit(10)
|
||||
@mats = @tournament.mats
|
||||
@matches = @tournament.matches.where(mat_id: nil).order('bout_number ASC').limit(10).includes(:wrestlers)
|
||||
@mats = @tournament.mats.includes(:matches)
|
||||
if @tournament.matches.empty?
|
||||
redirect_to "/static_pages/noMatches?tournament=#{@tournament.id}"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user