From 972c5af0932ea1488c3adcd0f57297297f0803b5 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Wed, 30 Jan 2019 14:16:26 +0000 Subject: [PATCH] Put number next to school on team scores page and included team scores into all brackets --- app/controllers/tournaments_controller.rb | 5 +++-- app/views/tournaments/all_brackets.html.erb | 1 + app/views/tournaments/team_scores.html.erb | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 39d31b8..68db85e 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -13,7 +13,7 @@ class TournamentsController < ApplicationController @wrestler = Wrestler.find(params[:wrestler][:originalId]) respond_to do |format| if SwapWrestlers.new.swap_wrestlers_bracket_lines(params[:wrestler][:originalId], params[:wrestler][:swapId]) - format.html { redirect_to "/tournaments/#{@wrestler.tournament.id}/brackets/#{@wrestler.weight.id}", notice: 'Wrestler was successfully swaped.' } + format.html { redirect_to "/tournaments/#{@wrestler.tournament.id}/brackets/#{@wrestler.weight.id}", notice: 'Wrestlers successfully swapped.' } format.json { render action: 'show', status: :created, location: @wrestler } end end @@ -149,7 +149,8 @@ class TournamentsController < ApplicationController def all_brackets - + @schools = @tournament.schools + @schools = @schools.sort_by{|s| s.page_score_string}.reverse! end def bracket diff --git a/app/views/tournaments/all_brackets.html.erb b/app/views/tournaments/all_brackets.html.erb index 1257a77..215be07 100644 --- a/app/views/tournaments/all_brackets.html.erb +++ b/app/views/tournaments/all_brackets.html.erb @@ -71,6 +71,7 @@ li:first-child,li:last-child {
+ <%= render :file => 'tournaments/team_scores' %> <% @tournament.weights.sort_by{|w| w.max}.each do |w| %>
<%= @tournament.name %> - <%= w.max %> lbs Bracket
diff --git a/app/views/tournaments/team_scores.html.erb b/app/views/tournaments/team_scores.html.erb index cba5501..60b086b 100644 --- a/app/views/tournaments/team_scores.html.erb +++ b/app/views/tournaments/team_scores.html.erb @@ -1,7 +1,8 @@ <% cache ["#{@tournament.id}_team_scores", @tournament] do %> + +

Team Scores

-
@@ -12,7 +13,7 @@ <% @schools.each do |school| %> - + <% end %>
Name
<%= school.name %> (<%= school.abbreviation %>)<%= @schools.index(school) + 1 %>. <%= school.name %> (<%= school.abbreviation %>) <%= school.page_score_string %>