Status: <%= @match.status %>

Tournament: <%= @match.tournament.id %>

Name: <%= @match.name %>

Teams/users

<% unless @match.winner.nil? %>

Winner: <%= @match.winner.users.collect{|u| u.user_name}.join(", ") %>

<% end %>
<%= form_tag(tournament_match_path(@tournament, @match), method: "put") do %> <% case @match.status %> <% when 0 %> <% if @tournament.hosts.include? current_user %> <%= submit_tag("Start Match", :disabled => @match.teams.count < @tournament.min_teams_per_match) %> <% else %>

Match is waiting to start.

<% end %> <% when 1 %> <% if @tournament.hosts.include? current_user %> <% @match.teams.each do |team| %>
Team <%= team.id.to_s %> <% team.users.collect{|u| u.user_name}.each do |k| %><% end %>
<% end %> <%= submit_tag("Finish match") %> <% else %>

The match is running; the host has yet to post the scores of the match.

<% end %> <% when 2 %> <% users = []; @match.teams.each{|t| users.concat(t.users)}; %> <% if users.include? current_user %> <% @match.teams.each do |team| %> <% if team.users.include?(current_user) %>
    <% team.users.reject{ |u| (u.user_name == @current_user.user_name) }.collect {|u| u.user_name }.each do |k| %>
  1. <%= k%>
    <% if (@tournament.game_id == 1) %> <%= if @blue2["#{k}"] == nil "Level: #{@purp2["#{k}"]["level"]} K/D/A: #{@purp2["#{k}"]["championsKilled"]}/#{@purp2["#{k}"]["numDeaths"]}/#{@purp2["#{k}"]["assists"]} Gold:#{@purp2["#{k}"]["goldEarned"]}" else "Level: #{@blue2["#{k}"]["level"]} K/D/A: #{@blue2["#{k}"]["championsKilled"]}/#{@blue2["#{k}"]["numDeaths"]}/#{@blue2["#{k}"]["assists"]} Gold:#{@blue2["#{k}"]["goldEarned"]}" end %> <% end %>
  2. <% end %>
<% end %> <% end %> <%= submit_tag("Submit peer evaluation", :onsubmit => "score_peers()") %> <% else %> Waiting for peer evaluations to be submitted. <% end %> <% when 3 %> This match is done. <%= submit_tag("Reset Status") %> <% end # case %> <% end # form %>