1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-08 07:22:38 +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> <% cache ["all_brackets", @tournament] do %>
.pagebreak {
page-break-after: always; <style>
border: none; .pagebreak {
margin: 0px; page-break-after: always;
padding: 0px; border: none;
width: 7in; /* width: 7in; */ margin: 0px;
height: 9.5in; /* or height: 9.5in; */ padding: 0px;
font-size: 10px; width: 7in; /* width: 7in; */
position: relative; height: 9.5in; /* or height: 9.5in; */
left: 1in; font-size: 10px;
height: 1in; position: relative;
} left: 1in;
height: 1in;
}
</style> </style>
<%= link_to "Back to #{@tournament.name} weights", "/tournaments/#{@tournament.id}/brackets" %> <%= link_to "Back to #{@tournament.name} weights", "/tournaments/#{@tournament.id}/brackets" %>
<br> <br>
<br> <br>
<div id="exportable"> <div id="exportable">
<% @tournament.weights.sort_by{|w| w.max}.each do |w| %> <% @tournament.weights.sort_by{|w| w.max}.each do |w| %>
<table class='pagebreak'> <table class='pagebreak'>
<td> <td>
<% @weight = w %> <% @weight = w %>
<% @matches = @tournament.matches.select{|m| m.weight_id == @weight.id} %> <% @matches = @tournament.matches.select{|m| m.weight_id == @weight.id} %>
<% @wrestlers = Wrestler.where(weight_id: @weight.id) %> <% @wrestlers = Wrestler.where(weight_id: @weight.id) %>
<% @pools = w.poolRounds(@matches) %> <% @pools = w.poolRounds(@matches) %>
<h5><%= @weight.max %> lbs Bracket</h5> <h5><%= @weight.max %> lbs Bracket</h5>
<%= render 'pool' %> <%= render 'pool' %>
</td> </td>
</table> </table>
<table class='pagebreak'> <table class='pagebreak'>
<td> <td>
<% if w.pool_bracket_type == "twoPoolsToFinal" %> <% if w.pool_bracket_type == "twoPoolsToFinal" %>
<%= render 'twoPoolFinalBracket' %> <%= render 'twoPoolFinalBracket' %>
<% end %> <% end %>
<% if w.pool_bracket_type == "twoPoolsToSemi" %> <% if w.pool_bracket_type == "twoPoolsToSemi" %>
<%= render 'twoPoolSemiBracket' %> <%= render 'twoPoolSemiBracket' %>
<% end %> <% end %>
<% if w.pool_bracket_type == "fourPoolsToQuarter" %> <% if w.pool_bracket_type == "fourPoolsToQuarter" %>
<%= render 'fourPoolQuarterBracket' %> <%= render 'fourPoolQuarterBracket' %>
<% end %> <% end %>
<% if w.pool_bracket_type == "fourPoolsToSemi" %> <% if w.pool_bracket_type == "fourPoolsToSemi" %>
<%= render 'fourPoolSemiBracket' %> <%= render 'fourPoolSemiBracket' %>
<% end %> <% end %>
</td> </td>
</table> </table>
<% end %>
</div>
<% end %> <% end %>
</div>