1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-08 07:22:38 +00:00

Refactored names of methods and some db column

This commit is contained in:
2018-11-13 14:14:48 +00:00
parent 93be525832
commit d67a8f2b42
44 changed files with 350 additions and 350 deletions

View File

@@ -7,11 +7,11 @@ class School < ActiveRecord::Base
validates :name, presence: true
before_destroy do
self.tournament.destroyAllMatches
self.tournament.destroy_all_matches
end
#calculate score here
def pageScore
def page_score_string
if self.score == nil
return 0.0
else
@@ -19,26 +19,26 @@ class School < ActiveRecord::Base
end
end
def calcScore
newScore = totalWrestlerPoints - totalDeductedPoints
def calculate_score
newScore = total_points_scored_by_wrestlers - total_points_deducted
self.score = newScore
self.save
end
if Rails.env.production?
handle_asynchronously :calcScore
handle_asynchronously :calculate_score
end
def totalWrestlerPoints
def total_points_scored_by_wrestlers
points = 0
self.wrestlers.each do |w|
if w.extra != true
points = points + w.totalTeamPoints
points = points + w.total_team_points
end
end
points
end
def totalDeductedPoints
def total_points_deducted
points = 0
deductedPoints.each do |d|
points = points + d.points