Only support stage count calculation for 1+ teams
This commit is contained in:
parent
d221928a12
commit
38425df823
|
|
@ -61,8 +61,8 @@ class PlayoffStageService
|
||||||
# @param number_of_teams [Integer] the teams number of teams to calculate amount of stages
|
# @param number_of_teams [Integer] the teams number of teams to calculate amount of stages
|
||||||
# @return [Integer] amount of required stages
|
# @return [Integer] amount of required stages
|
||||||
def self.calculate_required_stage_count(number_of_teams)
|
def self.calculate_required_stage_count(number_of_teams)
|
||||||
if number_of_teams.zero? || number_of_teams == 1
|
if number_of_teams == 1
|
||||||
0
|
1
|
||||||
else
|
else
|
||||||
# black voodoo magic
|
# black voodoo magic
|
||||||
stage_count = Math.log(Utils.next_power_of_two(number_of_teams)) / Math.log(2)
|
stage_count = Math.log(Utils.next_power_of_two(number_of_teams)) / Math.log(2)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue