summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/tournament_stage.rb8
-rw-r--r--app/views/matches/index.html.erb36
-rw-r--r--app/views/servers/edit.html.erb2
3 files changed, 26 insertions, 20 deletions
diff --git a/app/models/tournament_stage.rb b/app/models/tournament_stage.rb
index a24d7b9..9fa6dcd 100644
--- a/app/models/tournament_stage.rb
+++ b/app/models/tournament_stage.rb
@@ -19,11 +19,15 @@ class TournamentStage < ActiveRecord::Base
def to_svg
set_scheduling
- return @scheduling.graph(self)
+ return @scheduling.graph
end
private
def set_scheduling
- @scheduling ||= "Scheduling::#{self.scheduling}".constantize.new(self)
+ if @scheduling.nil?
+ require "scheduling/#{self.scheduling}"
+ @scheduling = "Scheduling::#{self.scheduling.capitalize}".constantize.new(self)
+ end
+ return @scheduling
end
end
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index abca42b..058477a 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -12,26 +12,30 @@
</thead>
<tbody class="table-hover">
- <% @tournament.matches.order(:id).reverse.each do |match| %><tr>
- <td><%= "Match #{match.id}" %></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">
- <% @startable = (match.status == 0) and (match.teams.count >= @tournament.min_teams_per_match) %>
- <%= submit_tag("Start Match", :disabled => ! @startable) %>
+ <% @tournament.stages_ordered.keys.sort.each do |stage_key| %>
+ <% stage = @tournament.stages_ordered[stage_key] %>
+ <% stage.matches_ordered.keys.sort.reverse.each do |match_key| %><tr>
+ <% match = stage.matches_ordered[match_key] %>
+ <td><%= "Match #{match.id}" %></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">
+ <% @startable = (match.status == 0) and (match.teams.count >= @tournament.min_teams_per_match) %>
+ <%= submit_tag("Start Match", :disabled => ! @startable) %>
+ <% end %>
<% end %>
- <% end %>
- </td>
- </tr><% end %>
+ </td>
+ </tr><% end %>
+ <% end %>
</tbody>
</table>
<br>
-<% @tournament.stages_ordered.each do |stage| %>
- <div class="graph"><%= stage.to_svg %></div>
+<% @tournament.stages_ordered.keys.sort.each do |stage_key| %>
+ <div class="graph"><%= raw @tournament.stages_ordered[stage_key].to_svg %></div>
<% end %>
diff --git a/app/views/servers/edit.html.erb b/app/views/servers/edit.html.erb
index d37864f..f29a65c 100644
--- a/app/views/servers/edit.html.erb
+++ b/app/views/servers/edit.html.erb
@@ -1,5 +1,3 @@
<h1>Editing server</h1>
<%= render 'form' %>
-
-<%= link_to server_path %>