1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +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

@@ -53,7 +53,7 @@ class GenerateTournamentMatches
end
def moveFinalsMatchesToLastRound
finalsRound = @tournament.totalRounds
finalsRound = @tournament.total_rounds
finalsMatches = @tournament.matches.reload.select{|m| m.bracket_position == "1/2" || m.bracket_position == "3/4" || m.bracket_position == "5/6" || m.bracket_position == "7/8"}
finalsMatches. each do |m|
m.round = finalsRound
@@ -66,7 +66,7 @@ class GenerateTournamentMatches
if matsToAssign.count > 0
until matsToAssign.sort_by{|m| m.id}.last.matches.count == 4
matsToAssign.sort_by{|m| m.id}.each do |m|
m.assignNextMatch
m.assign_next_match
end
end
end

View File

@@ -15,9 +15,9 @@ class PoolGeneration
end
def roundRobin
wrestlers = @weight.wrestlersForPool(@pool)
poolMatches = RoundRobinTournament.schedule(wrestlers).reverse
poolMatches.each_with_index do |b, index|
wrestlers = @weight.wrestlers_in_pool(@pool)
pool_matches = RoundRobinTournament.schedule(wrestlers).reverse
pool_matches.each_with_index do |b, index|
round = index + 1
bouts = b.map
bouts.each do |bout|

View File

@@ -30,14 +30,14 @@ class PoolToBracketMatchGeneration
def setOriginalSeedsToWrestleLastPoolRound(weight)
pool = 1
until pool > weight.pools
wrestler1 = weight.poolSeedOrder(pool).first
wrestler2 = weight.poolSeedOrder(pool).second
match = wrestler1.poolMatches.sort_by{|m| m.round}.last
wrestler1 = weight.pool_wrestlers_sorted_by_bracket_line(pool).first
wrestler2 = weight.pool_wrestlers_sorted_by_bracket_line(pool).second
match = wrestler1.pool_matches.sort_by{|m| m.round}.last
if match.w1 != wrestler2.id or match.w2 != wrestler2.id
if match.w1 == wrestler1.id
SwapWrestlers.new.swapWrestlers(match.w2,wrestler2.id)
SwapWrestlers.new.swap_wrestlers_bracket_lines(match.w2,wrestler2.id)
elsif match.w2 == wrestler1.id
SwapWrestlers.new.swapWrestlers(match.w1,wrestler2.id)
SwapWrestlers.new.swap_wrestlers_bracket_lines(match.w1,wrestler2.id)
end
end
pool += 1