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

Removed upcomingMatches because matches are an A-R relation of Tournament

This commit is contained in:
RJ Osborne
2015-05-28 00:25:14 -04:00
parent 062396da0a
commit 284439e2cf
3 changed files with 12 additions and 17 deletions

View File

@@ -8,10 +8,9 @@ class StaticPagesController < ApplicationController
@tournament = Tournament.find(params[:tournament])
end
if @tournament
if @tournament.matches.empty?
@matches = @tournament.matches
if @matches.empty?
redirect_to "/static_pages/noMatches?tournament=#{@tournament.id}"
else
@matches = @tournament.upcomingMatches
end
end
end
@@ -30,12 +29,12 @@ class StaticPagesController < ApplicationController
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
end
if @tournament
@matches = Match.where(tournament_id: @tournament.id)
end
if @tournament
@matches = @tournament.matches
end
@matches = @matches.where(finished: 1)
end
def brackets
if params[:weight]
@weight = Weight.find(params[:weight])
@@ -50,7 +49,7 @@ class StaticPagesController < ApplicationController
end
end
end
def all_brackets
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
@@ -85,7 +84,7 @@ class StaticPagesController < ApplicationController
@tournament = Tournament.find(params[:tournament])
end
end
def generate_matches
if !user_signed_in?
redirect_to root_path