diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index 0123134..0e5da20 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -8,6 +8,9 @@ class StaticPagesController < ApplicationController @tournament = Tournament.find(params[:tournament]) end if @tournament + if @tournamnet.matches == nil + render 'noMatches' + end @matches = @tournament.upcomingMatches end end @@ -37,9 +40,12 @@ class StaticPagesController < ApplicationController @weight = Weight.find(params[:weight]) @bracketType = @weight.pool_bracket_type @tournament = Tournament.find(@weight.tournament_id) - @matches = @tournament.upcomingMatches.select{|m| m.weight_id == @weight.id} + @matches = @tournament.matches.select{|m| m.weight_id == @weight.id} @wrestlers = Wrestler.where(weight_id: @weight.id) @pools = @weight.poolRounds(@matches) + if @matches == nil or @wrestlers == nil + render 'noMatches' + end end end diff --git a/app/views/tournaments/_noMatches.html.erb b/app/views/tournaments/_noMatches.html.erb new file mode 100644 index 0000000..f9bd439 --- /dev/null +++ b/app/views/tournaments/_noMatches.html.erb @@ -0,0 +1,2 @@ +
This view will not render until matches have been generated by the tournament director.
\ No newline at end of file