Merge pull request #76 from turniere/ticket/TUR-9

Manually sort position of groups of 4 teams
This commit is contained in:
Thor77 2019-11-09 00:42:42 +01:00 committed by GitHub
commit 1598db7796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,13 @@ class GroupStageService
group_scores: team_array.map { |team| GroupScore.new team: team }
end
def deal_with_spacing_of_teams(matches, team_size)
return unless team_size == 4
matches[2].position, matches[4].position = matches[4].position, matches[2].position
matches
end
def generate_all_matches_between(teams)
matches = []
teams.combination(2).to_a # = matchups
@ -29,7 +36,7 @@ class GroupStageService
]
matches << match
end
matches
deal_with_spacing_of_teams(matches, teams.size)
end
# Updates all group_scores of the given group