<div class="page">
  <div class="bracket-container">
    <h4><%= @tournament.name %> - <%= @weight.max %> Bracket</h4>
    <h4>Championship Bracket</h4>
    <div class="bracket">
      <% if @weight.highest_bracket_round %>
        <% (@weight.lowest_bracket_round..@weight.highest_bracket_round).each do |round| %>
          <%  @round_matches = @matches.select{|m|m.bracket_position.include? "Bracket" and m.round == round} %>
          <%= render 'bracket_round' %>
        <% end %>
      <% end %>
      <% @round_matches = @matches.select{|m|m.bracket_position == "Quarter"} %>
      <%= render 'bracket_round' %>
      <% @round_matches = @matches.select{|m|m.bracket_position == "Semis"} %>
      <%= render 'bracket_round' %>
      <% @final_match = @matches.select{|m|m.bracket_position == "1/2"} %>
      <% @winner_place = "1st" %>
      <%= render 'bracket_final' %>
    </div>
<! -- Only use a 2nd page for consolation bracket if bracket is bigger than 16 -->
<% if @weight.wrestlers.size > 16 %>
  </div>
</div>
<!-- <div class="page-landscape"> -->
<div class="page">
  <div class="bracket-container">
<% end %>
<! -- End if for only use a 2nd page for consolation bracket if bracket is bigger than 16 -->
    <h4><%= @tournament.name %> - <%= @weight.max %> Bracket</h4>
    <h4>Consolation Bracket</h4>
    <div class="bracket">
      <% if @weight.highest_conso_round %>
        <% (@weight.lowest_conso_round..@weight.highest_conso_round).each do |round| %>
          <%  @round_matches = @matches.select{|m|m.bracket_position.include? "Conso" and m.round == round} %>
          <%= render 'bracket_round' %>
        <% end %>
      <% end %>
      <% @final_match = @matches.select{|m|m.bracket_position == "3/4"} %>
      <% @winner_place = "3rd" %>
      <%= render 'bracket_final' %>
    </div>
    <% if @weight.wrestlers.size >= 6 && @tournament.number_of_placers >= 6 %>
    <h4>5/6 place match</h4>
    <div class="bracket">
      <% @final_match = @matches.select{|m|m.bracket_position == "5/6"} %>
      <% @winner_place = "5th" %>
      <%= render 'bracket_final' %>
    </div>
    <% end %>
    <% if @weight.wrestlers.size >= 8 && @tournament.number_of_placers >= 8 %>
      <h4>7/8 place match</h4>
      <div class="bracket">
        <% @final_match = @matches.select{|m|m.bracket_position == "7/8"} %>
        <% @winner_place = "7th" %>
        <%= render 'bracket_final' %>
      </div>
    <% end %>
  </div>
</div>