diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index a9ead2f..f5afb58 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -60,7 +60,7 @@ class TournamentsController < ApplicationController
def team_scores
@schools = @tournament.schools
- @schools.sort_by{|s| s.score}.reverse!
+ @schools = @schools.sort_by{|s| s.pageScore}.reverse!
end
diff --git a/app/models/school.rb b/app/models/school.rb
index aa6a325..4cfa93b 100644
--- a/app/models/school.rb
+++ b/app/models/school.rb
@@ -5,9 +5,18 @@ class School < ActiveRecord::Base
#calculate score here
+ def pageScore
+ if self.score == nil
+ return 0.0
+ else
+ return self.score
+ end
+ end
def calcScore
- totalWrestlerPoints - totalDeductedPoints
+ newScore = totalWrestlerPoints - totalDeductedPoints
+ self.score = newScore
+ self.save
end
def totalWrestlerPoints
diff --git a/app/views/mats/_match_edit_form.html.erb b/app/views/mats/_match_edit_form.html.erb
index 014f5cc..82ad91f 100644
--- a/app/views/mats/_match_edit_form.html.erb
+++ b/app/views/mats/_match_edit_form.html.erb
@@ -17,14 +17,17 @@
<%= f.label "Win Type" %>
<%= f.select(:win_type, Match::WIN_TYPES) %>
+
- <%= f.label "Winner" %> Please put in the id of the winner
+ <%= f.label "Winner" %> Please choose the winner
<%= f.collection_select :winner_id, @wrestlers, :id, :name %>
+
- <%= f.label "Score" %> Also put pin time here if applicable. If default or forfeit, leave blank
+ <%= f.label "Score" %> Also put pin time here if applicable. If default or forfeit, leave blank. Example: 7-2, 17-2, or 2:34
<%= f.text_field :score %>
+
<%= f.hidden_field :finished, :value => 1 %>
<%= f.hidden_field :round, :value => @match.round %>
diff --git a/app/views/tournaments/team_scores.html.erb b/app/views/tournaments/team_scores.html.erb
index 34d4d4a..0bee520 100644
--- a/app/views/tournaments/team_scores.html.erb
+++ b/app/views/tournaments/team_scores.html.erb
@@ -15,7 +15,7 @@
<% @schools.each do |school| %>
| <%= school.name %> |
- <%= school.score %> |
+ <%= school.pageScore %> |
<% end %>
diff --git a/app/views/wrestlers/show.html.erb b/app/views/wrestlers/show.html.erb
index 66c0e93..e658175 100644
--- a/app/views/wrestlers/show.html.erb
+++ b/app/views/wrestlers/show.html.erb
@@ -29,7 +29,7 @@
<% @wrestler.allMatches.each do |m| %>
- Bout: <%= m.bout_number %> <%= m.bracket_position %> <%= m.wrestler1.name %> vs. <%= m.wrestler2.name %> <%= m.bracketScore %>
+ Bout: <%= m.bout_number %> <%= m.bracket_position %> <%= m.wrestler1.name %> vs. <%= m.wrestler2.name %> <%= @wrestler.resultByBout(m.bout_number) %>
<% end %>
<% @wrestler.deductedPoints.each do |w| %>
Deducted points: <%= w.points %>