<%=TOURNAMENT_TITLE%>

<% if Pool.active_pools.size > 0 %> <% Pool.active_pools.each do |pool| -%>
<%= pool.name %> <% if current_user && pool.user_id == current_user.id %> <% if pool.tournament_entry -%> <%= link_to '[Tourny Results]', :controller => 'admin', :action => 'bracket', :id => pool.id %> <% end -%> <%= link_to '[Recap]', :controller => 'admin', :action => 'recap', :id => pool.id%> <%= link_to '[Edit]', :controller => 'admin', :action => 'pool', :id => pool.id %> <%= link_to '[Entries]', :controller => 'admin', :action => 'entries', :id => pool.id %> <% else %> <% if pool.tournament_entry -%> <%= link_to '[Tourny Results]', :controller => 'entry', :action => 'show', :id => pool.tournament_entry.id %> <% end %> <% end %> <%= link_to '[Leader Board]', :controller => 'reports', :action => 'show', :id => pool.id, :report => 'leader' %> <% if has_stats_file(pool.id) -%> <%= link_to '[Possibilities]', :controller => 'reports', :action => 'show', :id => pool.id, :report => 'possibility' %> <% end -%> <%= link_to '[Reports]', :controller => 'reports', :action => 'show', :id => pool.id %>
<% if pool.starts_at < Time.zone.now %>Started<%else%>Starts<%end%>: <%= distance_of_time_in_words(pool.starts_at, Time.now)%> <% if pool.starts_at < Time.zone.now %>ago.<%else%>from now.<%end%> Pending Entries: <%= pool.pending_entries.size%> Total Entries: <%= pool.user_entries.size%>
Last Update: <%=pool.updated_at.to_formatted_s(:long)%>
Entry Fee: <%=number_to_currency(pool.fee)%>
<% if pool.user_entries.size > 0 -%>
Payouts: <% take = pool.user_entries.size * pool.fee.to_f - (pool.payouts.inject(0) {|sum, p| sum += p.kind == '$' ? p.payout.to_i : 0}) %> <% pool.payouts.delete_if{|p| p.kind.blank?}.sort_by {|p| p.rank }.each do |p| -%> <%=p.rank != 'L' ? p.rank.to_i.ordinal : 'Last'%>: <%=number_to_currency(p.kind == '$' ? p.payout : p.payout.to_f / 100.0 * take)%>   <% end -%>
<% end -%>
Scoring: <%=pool.pool.scoring_strategy.description%>
<% if current_user -%> Entries for <%= current_user.login%>: <%= link_to pool.entries_for(current_user).size, :controller => 'entry', :action => 'index', :id => pool.id %> <% if pool.accepting_entries? -%> <%= link_to 'Add New Entry', :controller => 'entry', :action => 'new', :id => pool.id %> <% end -%>
<% else -%> To enter this pool, please <%= link_to 'login', login_path%> or <%= link_to 'signup', signup_path%> <% end -%>
<% end -%> <% else -%>
There are no active pools. Please come back in a bit or contact an administrator.
<% end -%>