Status: <%= @match.status %>

Tournament stage: <%= @match.tournament_stage %>

<%# Match Status 0 => Created, waiting to start Match Status 1 => Match ready Match Status 2 => Match is running, waiting to finish Match Status 3 => Match finished, waiting for statistics to populate Match Status 4 => Match Totally done. Archived. Four views:- (status is Match status) A. Pairings, when status is 1 for either Host or Player Or when status is 2 for player B. A page the host will see if status is 2 OR 3 C. The Peer review page that the players will see if status is 3. D. The page everyone will see when status is 4. Note: The change of status from 2 to 3 for League of Legends is coming from League Data Pull (RIOT API) %>

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 %> <%= raw @match.tournament_stage.tournament.sampling_method.camelcase.constantize.render_user_interaction(@match, current_user) %> <% 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 %>