diff --git a/app/models/wrestler.rb b/app/models/wrestler.rb
index 28fac50..015c6b6 100644
--- a/app/models/wrestler.rb
+++ b/app/models/wrestler.rb
@@ -1,7 +1,7 @@
class Wrestler < ActiveRecord::Base
belongs_to :school
belongs_to :weight
- attr_accessor :matches_all, :isWrestlingThisRound, :boutByRound
+ attr_accessor :matches_all, :isWrestlingThisRound, :boutByRound, :seasonWinPercentage
def isWrestlingThisRound(matchRound)
@gMatches = Match.where(g_id: self.id, round: matchRound)
@@ -29,4 +29,15 @@ class Wrestler < ActiveRecord::Base
return @gMatches + @rMatches
end
+ def seasonWinPercentage
+ if self.season_win > 0 and self.season_loss > 0
+ @percentage = self.season_win / (self.season_win + self.season_loss)
+ return @percentage
+ elsif self.season_win == 0
+ return 0
+
+ end
+
+ end
+
end
diff --git a/app/views/schools/show.html.erb b/app/views/schools/show.html.erb
index e13e669..1f89ea4 100644
--- a/app/views/schools/show.html.erb
+++ b/app/views/schools/show.html.erb
@@ -51,7 +51,7 @@
<%= Weight.find(wrestler.weight_id).max %> |
<%= wrestler.original_seed %> |
<%= wrestler.season_win %>-<%= wrestler.season_loss %> |
- <%= wrestler.criteria %> |
+ <%= wrestler.criteria %> Win <%= wrestler.seasonWinPercentage %>% |
<% if wrestler.extra? == true %>
Yes
<% end %> |
diff --git a/app/views/static_pages/brackets.html.erb b/app/views/static_pages/brackets.html.erb
index e4f7c69..0099db3 100644
--- a/app/views/static_pages/brackets.html.erb
+++ b/app/views/static_pages/brackets.html.erb
@@ -1,3 +1,7 @@
+
+
+
+
<%= link_to "Back to #{@tournament.name} weights", "/static_pages/weights?tournament=#{@tournament.id}" %>
diff --git a/app/views/weights/show.html.erb b/app/views/weights/show.html.erb
index 849327f..85ca098 100644
--- a/app/views/weights/show.html.erb
+++ b/app/views/weights/show.html.erb
@@ -30,7 +30,7 @@
<%= School.find(wrestler.school_id).name %> |
<%= wrestler.original_seed %> |
<%= wrestler.season_win %>-<%= wrestler.season_loss %> |
- <%= wrestler.criteria %> |
+ <%= wrestler.criteria %> Win <%= wrestler.seasonWinPercentage %>% |
<% if wrestler.extra? == true %>
Yes
<% end %> |