1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-04 22:03:49 +00:00

Cleaning up views and controllers

This commit is contained in:
2015-11-04 07:10:20 -05:00
parent 3695800001
commit a38c959d0c
9 changed files with 32 additions and 31 deletions

View File

@@ -97,18 +97,20 @@ class StaticPagesController < ApplicationController
Wrestler.update(params[:wrestler].keys, params[:wrestler].values)
end
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
@tournament = Tournament.where(:id => params[:tournament]).includes(:weights).first
@tournament_id = @tournament.id
@tournament_name = @tournament.name
end
if @tournament
@weights = Weight.where(tournament_id: @tournament.id)
@weights = @tournament.weights
@weights = @weights.sort_by{|x|[x.max]}
end
if params[:weight]
@weight = Weight.find(params[:weight])
@tournament_id = @weight.tournament_id
@tournament_name = Tournament.find(@tournament_id).name
@weight = Weight.where(:id => params[:weight]).includes(:tournament,:wrestlers).first
@tournament_id = @weight.tournament.id
@tournament_name = @weight.tournament.name
@tournament = @weight.tournament
@weights = @tournament.weights
end
if @weight
@wrestlers = @weight.wrestlers