1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Added pages for teampointsadjust and spearated wrestler and school deducted points

This commit is contained in:
2016-01-12 17:36:45 +00:00
parent 227e588658
commit c6626988db
9 changed files with 148 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
class School < ActiveRecord::Base
belongs_to :tournament, touch: true
has_many :wrestlers, dependent: :destroy
has_many :deductedPoints, through: :wrestlers
has_many :deductedPoints, class_name: "Teampointadjust"
has_many :delegates, class_name: "SchoolDelegate"
validates :name, presence: true
@@ -33,9 +33,14 @@ class School < ActiveRecord::Base
def totalDeductedPoints
points = 0
self.deductedPoints.each do |d|
deductedPoints.each do |d|
points = points + d.points
end
self.wrestlers.each do |w|
w.deductedPoints.each do |d|
points = points + d.points
end
end
points
end
end