<% if pool.entries.size > 0 -%> <% if show_header %>

Leader Report

<% end %> <% current_rank = 1 if pool.entries.size > 0 %> <% db_entry_ids = @pool.user_entries.inject({}) {|h,e| h[e.name] = e.id; h} pool.entries.sort do |e1, e2| s1 = e1.picks.score_against(pool.tournament_entry.picks, pool.scoring_strategy) s2 = e2.picks.score_against(pool.tournament_entry.picks, pool.scoring_strategy) if s1 == s2 && pool.tournament_entry.tie_breaker s1 = 0 - (e1.tie_breaker - pool.tournament_entry.tie_breaker).abs s2 = 0 - (e2.tie_breaker - pool.tournament_entry.tie_breaker).abs end s2 <=> s1 end.inject(nil) do |last_entry, entry| total = entry.picks.score_against(pool.tournament_entry.picks, pool.scoring_strategy) max = entry.picks.maximum_score(pool.tournament_entry.picks, pool.scoring_strategy) champ = entry.picks.champion round_scores = [] 1.upto(pool.tournament_entry.picks.rounds) do |round| scores = entry.picks.scores_for_round(round, pool.tournament_entry.picks, pool.scoring_strategy) round_scores << scores.inject(0) {|sum, arr| sum += (arr[0] ? arr[0] : 0)} end rank_display = nil if last_entry && !pool.tournament_entry.tie_breaker && total == last_entry.bracket.score_against(pool.tournament_entry.picks, pool.scoring_strategy) rank_display = 'TIE' else rank_display = "%4d" % current_rank end %> <% round_scores.each do |rs| %> <% end %> <% current_rank += 1 entry end end %>
Rank Current
Score
Max Score Entry Name Champ
Alive?
Tie
Break
Round Scores
1 2 3 4 5 6
<%=rank_display%> <%=total%> <%=max%> <%=link_to entry.name, :controller => 'entry', :action => 'show', :id => db_entry_ids[entry.name]%> <%=champ.short_name%> <%=pool.tournament_entry.picks.still_alive?(champ) ? 'Y' : 'N'%> <%=entry.tie_breaker || '-'%><%=rs%>
<% else -%>

Leader Report

There are no entries in the pool.

<% end -%>