mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Record score in db and update when match is updated
This commit is contained in:
@@ -60,7 +60,7 @@ class TournamentsController < ApplicationController
|
||||
|
||||
def team_scores
|
||||
@schools = @tournament.schools
|
||||
@schools.sort_by{|s| s.score}
|
||||
@schools.sort_by{|s| s.score}.reverse!
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ class Match < ActiveRecord::Base
|
||||
after_save do
|
||||
if self.finished == 1
|
||||
advance_wrestlers
|
||||
self.wrestler1.school.calcScore
|
||||
self.wrestler2.school.calcScore
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -5,9 +5,6 @@ class School < ActiveRecord::Base
|
||||
|
||||
|
||||
#calculate score here
|
||||
def score
|
||||
calcScore
|
||||
end
|
||||
|
||||
def calcScore
|
||||
totalWrestlerPoints - totalDeductedPoints
|
||||
|
||||
Reference in New Issue
Block a user