diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb
index 86ae360..fb659e9 100644
--- a/app/controllers/static_pages_controller.rb
+++ b/app/controllers/static_pages_controller.rb
@@ -11,6 +11,17 @@ class StaticPagesController < ApplicationController
@matches = @tournament.upcomingMatches
end
end
+
+ def team_scores
+ if params[:tournament]
+ @tournament = Tournament.find(params[:tournament])
+ end
+ if @tournament
+ @schools = School.where(tournament_id: @tournament.id)
+ @schools.sort_by{|x|[x.score]}
+ end
+ end
+
def results
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 7ab73bd..ffd4dbd 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -9,6 +9,7 @@
<%= link_to "Brackets" , "/static_pages/weights?tournament=#{@tournament.id}" %>
<%= link_to "Upcoming Matches" , "/static_pages/up_matches?tournament=#{@tournament.id}" %>
<%= link_to "Results" , "/static_pages/results?tournament=#{@tournament.id}" %>
+ <%= link_to "Team Scores" , "/static_pages/team_scores?tournament=#{@tournament.id}" %>
<% end %>
<% if user_signed_in? %>
<%= link_to "Log Out", destroy_user_session_path, method: :delete %>
diff --git a/app/views/static_pages/team_scores.html.erb b/app/views/static_pages/team_scores.html.erb
new file mode 100644
index 0000000..9258f9e
--- /dev/null
+++ b/app/views/static_pages/team_scores.html.erb
@@ -0,0 +1,22 @@
+<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" %>
+
+
+
+Team Scores
+
+
+
+ | Name |
+ Score |
+
+
+
+
+ <% @schools.each do |school| %>
+
+ | <%= school.name %> |
+ <%= school.score %> |
+
+ <% end %>
+
+
\ No newline at end of file
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index e9b73e0..66d9a53 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -37,7 +37,6 @@
| Name |
- Score |
|
@@ -46,7 +45,6 @@
<% @schools.each do |school| %>
| <%= school.name %> |
- <%= school.score %> |
<%= link_to 'Show', school, :class=>"btn" %>
<% if user_signed_in? %>
<%= link_to 'Edit', edit_school_path(school), :class=>"btn" %>
diff --git a/config/routes.rb b/config/routes.rb
index 3a94f13..09ef9c1 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -28,6 +28,7 @@ Wrestling::Application.routes.draw do
get 'static_pages/up_matches'
get 'static_pages/control_match'
get 'static_pages/results'
+ get 'static_pages/team_scores'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
|