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

Added mat assignment rules for the bout board and fixed the bug where a delegate making the tournamnet info public changes them to the owner

This commit is contained in:
2024-11-25 16:25:59 -05:00
parent bb548be81b
commit ad8e486205
19 changed files with 769 additions and 43 deletions

View File

@@ -16,7 +16,6 @@ class GenerateTournamentMatches
@tournament.curently_generating_matches = 1
@tournament.save
unAssignBouts
unAssignMats
PoolToBracketMatchGeneration.new(@tournament).generatePoolToBracketMatchesWeight(weight) if @tournament.tournament_type == "Pool to bracket"
postMatchCreationActions
PoolToBracketGenerateLoserNames.new(@tournament).assignLoserNamesWeight(weight) if @tournament.tournament_type == "Pool to bracket"
@@ -51,7 +50,7 @@ class GenerateTournamentMatches
def postMatchCreationActions
moveFinalsMatchesToLastRound
assignBouts
assignFirstMatchesToMats
@tournament.reset_and_fill_bout_board
@tournament.curently_generating_matches = nil
@tournament.save!
end
@@ -75,17 +74,6 @@ class GenerateTournamentMatches
end
end
def assignFirstMatchesToMats
matsToAssign = @tournament.mats
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.assign_next_match
end
end
end
end
def unAssignMats
matches = @tournament.matches.reload
matches.each do |m|