<%= @tournament.name %> - Matches

<% @tournament.matches.each do |match| %> <% end %>
Status Name Winner
<%= match.status %> <%= match.id%> <%= match.name %> <%= link_to "Show", tournament_match_path(@tournament, match) %> <%# If user is the host, let them start the tournment %> <% if @tournament.hosts.include?(current_user) %> <%= form_tag(tournament_match_path(@tournament, match), method: "put") do %> <%= submit_tag("Start Match") %> <% end %> <% end %>

<% (1..@matches.count).each do |i| %> <% when 0 %> <% if @matches[i-1].teams.count < @tournament.min_teams_per_match %> stroke="red" fill-opacity="0.6" <% else %> stroke="green" <% end %> <% when 1 %> stroke="orange" <% when 2 %> stroke="yellow" <% when 3 %> stroke="grey" <% end %> /> <% if i > 1 %> <% end %> <% end %>