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