1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-30 19:22:21 +00:00
Files
wrestlingdev.com/app/controllers/static_pages_controller.rb
2015-02-06 03:01:17 +00:00

70 lines
1.4 KiB
Ruby

class StaticPagesController < ApplicationController
def index
@tournaments = Tournament.all
end
def up_matches
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
end
if @tournament
@matches = @tournament.upcomingMatches
end
end
def results
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
end
if @tournament
@matches = Match.where(tournament_id: @tournament.id)
end
@matches = @matches.where(finished: 1)
end
def brackets
if params[:weight]
@weight = Weight.find(params[:weight])
@tournament = Tournament.find(@weight.tournament_id)
@poolOneWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 1)
@poolTwoWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 2)
@poolThreeWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 3)
@poolFourWrestlers = Wrestler.where(weight_id: @weight.id, poolNumber: 4)
end
end
def weights
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
end
if @tournament
@weights = Weight.where(tournament_id: @tournament.id)
end
end
def generate_matches
if user_signed_in?
else
redirect_to root_path
end
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
end
if @tournament
@tournament.generateMatches
end
end
end