1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Cached all_brackets page

This commit is contained in:
2015-12-29 15:13:43 +00:00
parent efe4036a5e
commit 50641edce3

View File

@@ -1,52 +1,55 @@
<style>
.pagebreak {
page-break-after: always;
border: none;
margin: 0px;
padding: 0px;
width: 7in; /* width: 7in; */
height: 9.5in; /* or height: 9.5in; */
font-size: 10px;
position: relative;
left: 1in;
height: 1in;
}
<% cache ["all_brackets", @tournament] do %>
</style>
<%= link_to "Back to #{@tournament.name} weights", "/tournaments/#{@tournament.id}/brackets" %>
<br>
<br>
<div id="exportable">
<% @tournament.weights.sort_by{|w| w.max}.each do |w| %>
<table class='pagebreak'>
<td>
<% @weight = w %>
<% @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>
<%= render 'pool' %>
</td>
</table>
<table class='pagebreak'>
<td>
<% if w.pool_bracket_type == "twoPoolsToFinal" %>
<%= render 'twoPoolFinalBracket' %>
<% end %>
<% if w.pool_bracket_type == "twoPoolsToSemi" %>
<%= render 'twoPoolSemiBracket' %>
<% end %>
<% if w.pool_bracket_type == "fourPoolsToQuarter" %>
<%= render 'fourPoolQuarterBracket' %>
<% end %>
<% if w.pool_bracket_type == "fourPoolsToSemi" %>
<%= render 'fourPoolSemiBracket' %>
<% end %>
</td>
</table>
<% end %>
</div>
<style>
.pagebreak {
page-break-after: always;
border: none;
margin: 0px;
padding: 0px;
width: 7in; /* width: 7in; */
height: 9.5in; /* or height: 9.5in; */
font-size: 10px;
position: relative;
left: 1in;
height: 1in;
}
</style>
<%= link_to "Back to #{@tournament.name} weights", "/tournaments/#{@tournament.id}/brackets" %>
<br>
<br>
<div id="exportable">
<% @tournament.weights.sort_by{|w| w.max}.each do |w| %>
<table class='pagebreak'>
<td>
<% @weight = w %>
<% @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>
<%= render 'pool' %>
</td>
</table>
<table class='pagebreak'>
<td>
<% if w.pool_bracket_type == "twoPoolsToFinal" %>
<%= render 'twoPoolFinalBracket' %>
<% end %>
<% if w.pool_bracket_type == "twoPoolsToSemi" %>
<%= render 'twoPoolSemiBracket' %>
<% end %>
<% if w.pool_bracket_type == "fourPoolsToQuarter" %>
<%= render 'fourPoolQuarterBracket' %>
<% end %>
<% if w.pool_bracket_type == "fourPoolsToSemi" %>
<%= render 'fourPoolSemiBracket' %>
<% end %>
</td>
</table>
<% end %>
</div>
<% end %>