1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-03 21:33:48 +00:00

Swap page is now working and also moved swaping logic from tournament model to its own class

This commit is contained in:
2016-01-27 14:13:49 +00:00
parent 96c7cd446c
commit a8b96c96e8
10 changed files with 80 additions and 73 deletions

View File

@@ -7,14 +7,14 @@ class Match < ActiveRecord::Base
after_update do
if self.finished == 1 && self.winner_id != nil
if self.w1 && self.w2
if self.finished == 1 && self.winner_id != nil
if self.w1 && self.w2
wrestler1.touch
wrestler2.touch
end
advance_wrestlers
calcSchoolPoints
end
end
end
WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default", "DQ"]
@@ -136,14 +136,5 @@ class Match < ActiveRecord::Base
end
end
def swapWrestlers(wrestler1_id,wrestler2_id)
if self.w1 == wrestler1_id
self.w1 = wrestler2_id
self.save
elsif self.w2 == wrestler1_id
self.w2 = wrestler2_id
self.save
end
end
end