From 4b447b86f94d8ba68a8daa36ea0da73ebe653cef Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 15 Oct 2015 15:13:52 -0400 Subject: [PATCH] Added winner name for final line of brackets --- app/models/match.rb | 12 +++++++++++- .../_fourPoolQuarterBracket.html.erb | 18 +++++++++--------- .../static_pages/_fourPoolSemiBracket.html.erb | 16 ++++++++-------- .../static_pages/_twoPoolFinalBracket.html.erb | 8 ++++---- .../static_pages/_twoPoolSemiBracket.html.erb | 8 ++++---- 5 files changed, 36 insertions(+), 26 deletions(-) diff --git a/app/models/match.rb b/app/models/match.rb index cab7721..cd8f3bc 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -44,7 +44,17 @@ class Match < ActiveRecord::Base self.loser2_name end end - + def winnerName + if self.finished != 1 + return "" + end + if self.winner_id == self.w1 + return self.w1_name + end + if self.winner_id == self.w2 + return self.w2_name + end + end def weight_max Weight.find(self.weight_id).max end diff --git a/app/views/static_pages/_fourPoolQuarterBracket.html.erb b/app/views/static_pages/_fourPoolQuarterBracket.html.erb index c686184..216510c 100644 --- a/app/views/static_pages/_fourPoolQuarterBracket.html.erb +++ b/app/views/static_pages/_fourPoolQuarterBracket.html.erb @@ -95,17 +95,17 @@ li.game{
  •  
  • - <% end %> + + <% end %>
    3rd/4th
    @@ -120,17 +120,17 @@ li.game{
  •  
  • - <% end %> + <% end %>
    Consolation Bracket After Pool
    @@ -157,17 +157,17 @@ li.game{
  •  
  • - <% end %> + <% end %>
    7th/8th
    @@ -182,17 +182,17 @@ li.game{
  •  
  • - <% end %> + <% end %>
    diff --git a/app/views/static_pages/_fourPoolSemiBracket.html.erb b/app/views/static_pages/_fourPoolSemiBracket.html.erb index a8e5294..8f7791c 100644 --- a/app/views/static_pages/_fourPoolSemiBracket.html.erb +++ b/app/views/static_pages/_fourPoolSemiBracket.html.erb @@ -83,17 +83,17 @@ li.game{
  •  
  • - <% end %> + <% end %>
    @@ -109,17 +109,17 @@ li.game{
  •  
  • - <% end %> + <% end %>
    @@ -148,17 +148,17 @@ li.game{
  •  
  • - <% end %> + <% end %>
    7th/8th
    @@ -173,17 +173,17 @@ li.game{
  •  
  • - <% end %> + <% end %>
    diff --git a/app/views/static_pages/_twoPoolFinalBracket.html.erb b/app/views/static_pages/_twoPoolFinalBracket.html.erb index d2d3c5c..99442e2 100644 --- a/app/views/static_pages/_twoPoolFinalBracket.html.erb +++ b/app/views/static_pages/_twoPoolFinalBracket.html.erb @@ -71,16 +71,16 @@ li.game{
  •  
  • - <% end %> + <% end %>
    3rd/4th
    @@ -95,15 +95,15 @@ li.game{
  •  
  • - <% end %> + <% end %> diff --git a/app/views/static_pages/_twoPoolSemiBracket.html.erb b/app/views/static_pages/_twoPoolSemiBracket.html.erb index 28a6613..dd1497a 100644 --- a/app/views/static_pages/_twoPoolSemiBracket.html.erb +++ b/app/views/static_pages/_twoPoolSemiBracket.html.erb @@ -83,17 +83,17 @@ li.game{
  •  
  • - <% end %> + <% end %>
    @@ -109,15 +109,15 @@ li.game{
  •  
  • - <% end %> + <% end %>