mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-24 14:53:18 +00:00
Removed upcomingMatches because matches are an A-R relation of Tournament
This commit is contained in:
@@ -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])
|
||||
|
||||
@@ -24,10 +24,6 @@ class Tournament < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def upcomingMatches
|
||||
matches
|
||||
end
|
||||
|
||||
def destroyAllMatches
|
||||
matches.destroy_all
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<% @tournament.weights.sort_by{|w| w.max}.each do |w| %>
|
||||
<div class="pagebreak">
|
||||
<% @weight = w %>
|
||||
<% @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 = w.poolRounds(@matches) %>
|
||||
<h5><%= @weight.max %> lbs Bracket</h5>
|
||||
|
||||
Reference in New Issue
Block a user