Fix start point for stages with matchnumbers that are not powers of 2
This commit is contained in:
parent
1c2d051364
commit
49a6545af9
|
|
@ -37,9 +37,11 @@ class MatchService
|
|||
matches << match
|
||||
end
|
||||
|
||||
# the start point is to compensate for all the teams that are already within a "normal" match
|
||||
startpoint = matches.size
|
||||
until matches.size >= needed_games
|
||||
# while we do not have enough matches in general we need to fill the array with "single team" matches
|
||||
i = matches.size
|
||||
i = matches.size + startpoint
|
||||
match = Match.new state: :single_team, position: i, match_scores: [MatchScore.create(team: teams[i])]
|
||||
matches << match
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue