mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-12 08:18:44 +00:00
Switched back to original way I swapped wrestlers
This commit is contained in:
@@ -140,24 +140,47 @@ class Tournament < ActiveRecord::Base
|
|||||||
w1 = Wrestler.find(wrestler1_id)
|
w1 = Wrestler.find(wrestler1_id)
|
||||||
w2 = Wrestler.find(wrestler2_id)
|
w2 = Wrestler.find(wrestler2_id)
|
||||||
|
|
||||||
w1Matches = w1.allMatches
|
#placeholder guy
|
||||||
w1Seed = w1.seed
|
w3 = Wrestler.new
|
||||||
w2Matches = w2.allMatches
|
w3.name = w1.name
|
||||||
w2Seed = w2.seed
|
w3.school_id = w1.school_id
|
||||||
|
w3.weight_id = w1.weight_id
|
||||||
w1Matches.each do |m|
|
w3.season_win = w1.season_win
|
||||||
m.swapWrestlers(wrestler1_id,wrestler2_id)
|
w3.season_loss = w1.season_loss
|
||||||
|
w3.criteria = w1.criteria
|
||||||
|
w3.original_seed = w1.original_seed
|
||||||
|
w3.seed = w1.seed
|
||||||
|
|
||||||
|
|
||||||
|
#Swap wrestler 1 and wrestler 2
|
||||||
|
w1.name = w2.name
|
||||||
|
w1.school_id = w2.school_id
|
||||||
|
w1.weight_id = w2.weight_id
|
||||||
|
w1.season_win = w2.season_win
|
||||||
|
w1.season_loss = w2.season_loss
|
||||||
|
w1.criteria = w2.criteria
|
||||||
|
w1.original_seed = w2.original_seed
|
||||||
|
w1.seed = w2.seed
|
||||||
|
|
||||||
|
|
||||||
|
w2.name = w3.name
|
||||||
|
w2.school_id = w3.school_id
|
||||||
|
w2.weight_id = w3.weight_id
|
||||||
|
w2.season_win = w3.season_win
|
||||||
|
w2.season_loss = w3.season_loss
|
||||||
|
w2.criteria = w3.criteria
|
||||||
|
w2.original_seed = w3.original_seed
|
||||||
|
w2.seed = w3.seed
|
||||||
|
|
||||||
|
|
||||||
|
w1.save
|
||||||
|
w2.save
|
||||||
|
end
|
||||||
|
|
||||||
|
def swapWrestlerMatches(matchesToSwap,w1_id,w2_id)
|
||||||
|
matchesToSwap.each do |m|
|
||||||
|
m.swapWrestlers(w1_id,w2_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
w2Matches.each do |m|
|
|
||||||
m.swapWrestlers(wrestler2_id,wrestler1_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
w1.seed = w2Seed
|
|
||||||
w1.save
|
|
||||||
|
|
||||||
w2.seed = w1Seed
|
|
||||||
w2.save
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user