mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-11 16:01:56 +00:00
Fix team score to have half a point
This commit is contained in:
@@ -45,13 +45,13 @@ class School < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def calculate_score_raw
|
def calculate_score_raw
|
||||||
newScore = total_points_scored_by_wrestlers - total_points_deducted
|
newScore = total_points_scored_by_wrestlers - total_points_deducted
|
||||||
self.score = newScore
|
self.score = newScore
|
||||||
self.save
|
self.save
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_points_scored_by_wrestlers
|
def total_points_scored_by_wrestlers
|
||||||
points = 0
|
points = 0.0
|
||||||
self.wrestlers.each do |w|
|
self.wrestlers.each do |w|
|
||||||
if w.extra != true
|
if w.extra != true
|
||||||
points = points + w.total_team_points
|
points = points + w.total_team_points
|
||||||
@@ -61,7 +61,7 @@ class School < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def total_points_deducted
|
def total_points_deducted
|
||||||
points = 0
|
points = 0.0
|
||||||
deductedPoints.each do |d|
|
deductedPoints.each do |d|
|
||||||
points = points + d.points
|
points = points + d.points
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user