From 2d097c71a32646fce3b90608cbffde9992c979ef Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Sun, 6 Apr 2014 23:29:40 -0400 Subject: holy shit matches actually move forward --- app/views/matches/show.html.erb | 77 +++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 11 deletions(-) (limited to 'app/views') diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 25be7b8..109aa70 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -26,36 +26,71 @@ Note:- The change of status from 1 to 2 is coming from League Data Pull (RIOT API) --> +<% if (@match.status== 0) || !@tournament.players.include?(current_user) %> + <% @match.teams.each do |team| %> +
    + <% team.users.collect{|u| u.user_name}.each do |k| %> +
  1. <%= k %>
  2. + <% end %> +
+ <% end %> + -<% if (@match.status==1) %> - <% if (@tournament.players.include?(current_user) || @tournament.hosts.include?(current_user)) %> +<% elsif (@match.status==1) %> + <% if @tournament.hosts.include?(current_user) && @scores.empty? %> + <%= form_tag(tournament_match_path(@tournament, @match), method: "put") do %> + + <% @match.teams.each do |team| %> +
Team <%= team.id.to_s %> + <% team.users.collect{|u| u.user_name}.each do |k| %> + + <% end %> +
+ <% end %> + <%= submit_tag("Enter Scores") %> + <% end %> + <% else %> + <% if @scores.empty? %> +

The host has yet to post the scores of the match

<% @match.teams.each do |team| %>
    <% team.users.collect{|u| u.user_name}.each do |k| %>
  1. <%= k %>
  2. <% end %>
- <% end %> + <% end %> + <% else %> + <% @match.teams.each do |team| %> +
    + <% team.users.each do |user| %> +
  1. <%= user.user_name %> - SCORE: <%= @scores.select{|s| s.user == user}.first.value %>
  2. + <% end %> +
+ <% end %> + <% end %> <% end %> -<% end %> -<% if (@match.status==0) %> +<% elsif (@match.status==2) %> <% if (@tournament.players.include?(current_user)) %> <% @match.teams.each do |team| %> -
    - <% team.users.collect{|u| u.user_name}.each do |k| %> -
  1. <%= k %>
  2. - <% end %> -
- + <% if team.users.include?(current_user) %> +
    + <% team.users.collect{|u| u.user_name}.each do |k| %> +
  1. <%= k %>
  2. + <% end %> +
+ <% end %> <% end %> <% elsif (@tournament.hosts.include?(current_user)) %> @@ -69,3 +104,23 @@

<% end %> +<% if @tournament.hosts.include?(current_user) %> +
+
+ <%= form_tag(tournament_match_path(@tournament, @match), method: "put") do %> + <% case @match.status %> + <% when 0 %> + + <%= submit_tag("Start Match") %> + <% when 1 %> + + <%= submit_tag("Begin Peer Evaluation") %> + <% when 2 %> + + <%= submit_tag("End Match") %> + <% end %> + <% end %> + + +
+<% end %> -- cgit v1.2.3-2-g168b