From 42b46cb6704e5ac8de8883f36116238077798e29 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 21 Apr 2015 19:32:37 -0400 Subject: [PATCH] Removed some logic from view for faster rendering --- app/controllers/static_pages_controller.rb | 1 + app/views/static_pages/_pool.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index c0562a9..0123134 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -39,6 +39,7 @@ class StaticPagesController < ApplicationController @tournament = Tournament.find(@weight.tournament_id) @matches = @tournament.upcomingMatches.select{|m| m.weight_id == @weight.id} @wrestlers = Wrestler.where(weight_id: @weight.id) + @pools = @weight.poolRounds(@matches) end end diff --git a/app/views/static_pages/_pool.html.erb b/app/views/static_pages/_pool.html.erb index a435923..209239f 100644 --- a/app/views/static_pages/_pool.html.erb +++ b/app/views/static_pages/_pool.html.erb @@ -7,7 +7,7 @@ Name <% until @matches.select{|m| m.round == @round}.blank? %> - <% if @round <= @weight.poolRounds(@matches) %> + <% if @round <= @pools %> R<%= @round %> <% end %> <% @round = @round + 1 %> @@ -20,7 +20,7 @@ <%= w.original_seed %> <%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %> <% @round = 1 %> <% until @matches.select{|m| m.round == @round}.blank? %> - <% if @round <= @weight.poolRounds(@matches) %> + <% if @round <= @pools %> <%= w.boutByRound(@round,@matches) %>
Result <% end %> <% @round = @round + 1 %>