diff options
author | guntasgrewal <guntasgrewal@gmail.com> | 2014-04-07 02:08:30 -0400 |
---|---|---|
committer | guntasgrewal <guntasgrewal@gmail.com> | 2014-04-07 02:08:30 -0400 |
commit | 4b76651ab6aa295eb9f2f9b7787f8d0fd612526c (patch) | |
tree | 2f888242952da717cc148691c84067aad8742267 /app | |
parent | 13fe3bab84f236b46b3dbda080a22051553346c2 (diff) |
fix bugs
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/matches_controller.rb | 2 | ||||
-rw-r--r-- | app/views/matches/index.html.erb | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index e88b6ef..8e7cc9e 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -177,7 +177,7 @@ class MatchesController < ApplicationController @match.teams.each do |team| team_scores[team] = 0 team.users.each do |user| - team_scores[team] += scores[user.user_name] + team_scores[team] += scores[user.user_name].to_i end end diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 1941179..5a18109 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -4,26 +4,25 @@ <table class="table"> <thead> <tr> - <th>Status</th> <th>Name</th> + <th>Status</th> <th>Winner</th> <th></th> </tr> </thead> <tbody class="table-hover"> - <% @tournament.matches.each do |match| %> + <% @tournament.matches.order(:id).reverse.each do |match| %> <tr> - <td><%= match.status %></td> - <td><%= match.id%></td> <td><%= match.name %></td> + <td><%= match.status %></td> + <td><%= (match.winner.nil? ? "-" : "Team #{match.winner.id}") %></td> <td><%= link_to "Show", tournament_match_path(@tournament, match) %> <td> <%# 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 %> <input type="hidden" name="update_action" value="start"> - <%= submit_tag("Start Match") %> + <%= submit_tag("Start Match", :dissabled => match.teams.count < @tournament.min_teams_per_match) %> <% end %> <% end %> </div></td> |