Subtract one off required stages if the number of teams is a power of 2
This way we now calculate the right amount of stages for every number. (I would test every number, but Jonas won't let me write tests for all of them..)
This commit is contained in:
parent
00bc8c82e3
commit
1c2d051364
|
|
@ -65,7 +65,8 @@ class PlayoffStageService
|
||||||
0
|
0
|
||||||
else
|
else
|
||||||
# black voodoo magic
|
# black voodoo magic
|
||||||
stage_count = Math.log(Utils.previous_power_of_two(number_of_teams)) / Math.log(2)
|
stage_count = Math.log(Utils.next_power_of_two(number_of_teams)) / Math.log(2)
|
||||||
|
stage_count -= 1 if Utils.po2?(number_of_teams)
|
||||||
stage_count.to_int
|
stage_count.to_int
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue