Manually sort position of groups of 4 teams

This commit is contained in:
Daniel Schädler 2019-11-08 23:51:23 +01:00
parent 0ded7bde1a
commit 8c39fa9894
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)
if team_size == 4
matches[2].position, matches[4].position = matches[4].position, matches[2].position
matches
end
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