mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Fixed noMatches page.
This commit is contained in:
@@ -8,10 +8,11 @@ class StaticPagesController < ApplicationController
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
end
|
||||
if @tournament
|
||||
if @tournamnet.matches == nil
|
||||
render 'noMatches'
|
||||
if @tournament.matches.empty?
|
||||
redirect_to "/static_pages/noMatches?tournament=#{@tournament.id}"
|
||||
else
|
||||
@matches = @tournament.upcomingMatches
|
||||
end
|
||||
@matches = @tournament.upcomingMatches
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,13 +39,14 @@ class StaticPagesController < ApplicationController
|
||||
def brackets
|
||||
if params[:weight]
|
||||
@weight = Weight.find(params[:weight])
|
||||
@bracketType = @weight.pool_bracket_type
|
||||
@tournament = Tournament.find(@weight.tournament_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'
|
||||
if @matches.empty? or @wrestlers.empty?
|
||||
redirect_to "/static_pages/noMatches?tournament=#{@tournament.id}"
|
||||
else
|
||||
@pools = @weight.poolRounds(@matches)
|
||||
@bracketType = @weight.pool_bracket_type
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -64,4 +66,10 @@ class StaticPagesController < ApplicationController
|
||||
@weights = @weights.sort_by{|x|[x.max]}
|
||||
end
|
||||
end
|
||||
|
||||
def noMatches
|
||||
if params[:tournament]
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" %>
|
||||
<br>
|
||||
<br>
|
||||
<h1>No Matches</h1>
|
||||
<p>This view will not render until matches have been generated by the tournament director.</p>
|
||||
@@ -29,6 +29,7 @@ Wrestling::Application.routes.draw do
|
||||
get 'static_pages/control_match'
|
||||
get 'static_pages/results'
|
||||
get 'static_pages/team_scores'
|
||||
get 'static_pages/noMatches'
|
||||
|
||||
|
||||
# Example of regular route:
|
||||
|
||||
Reference in New Issue
Block a user