diff options
Diffstat (limited to 'http/api-inc.php')
-rw-r--r-- | http/api-inc.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/http/api-inc.php b/http/api-inc.php index 64612d9..565e66c 100644 --- a/http/api-inc.php +++ b/http/api-inc.php @@ -74,7 +74,7 @@ class ApiPkl { if (!isset($this->parameters['manual']) || !isset($this->parameters['manual']['min_points']) || !isset($this->parameters['manual']['tournament_weight'])) { $this->ensure_parameters(array('tournament_rank', 'over39_boards')); $this->check_values($this->parameters, array( - 'tournament_rank' => function($r) { return ctype_digit($r) && ((intval($r) >= 0 && intval($r) <= 7) || intval($r) == self::RANK_KMP); }, + 'tournament_rank' => function($r) { return ctype_digit($r) && ((intval($r) >= 0 && intval($r) <= 7) || intval($r) == ApiPkl::RANK_KMP); }, 'over39_boards' => function($r) { return ctype_digit($r) && intval($r) >= 0 && intval($r) <= 1; } )); } else { @@ -96,20 +96,20 @@ class ApiPkl { if ($return['type'] == 3 || $return['type'] > 4) { throw new ParametersException('Parameter: type has incorrect value (' . $return['type'] . ')'); } - if ($return['type'] != 2 && $this->parameters['tournament_rank'] == self::RANK_KMP) { + if ($return['type'] != 2 && $this->parameters['tournament_rank'] == ApiPkl::RANK_KMP) { throw new ParametersException('Parameter: type has incorrect value (' . $return['type'] . ') for KMP tournament'); } $return['contestants'] = intval($this->parameters['contestants']); $return['players'] = isset($this->parameters['players']) ? intval($this->parameters['players']) : intval($this->parameters['contestants']) * $return['type']; $return['title_sum'] = floatval($this->parameters['title_sum']); $weights = array( - array(1, 2, 4, 5, 7, 10, 15, 25, self::RANK_KMP => 0), - array(2, 3, 5, 7, 10, 15, 25, 40, self::RANK_KMP => 0) + array(1, 2, 4, 5, 7, 10, 15, 25, ApiPkl::RANK_KMP => 0), + array(2, 3, 5, 7, 10, 15, 25, 40, ApiPkl::RANK_KMP => 0) ); $return['tournament_weight'] = (isset($this->parameters['manual']) && isset($this->parameters['manual']['tournament_weight'])) ? intval($this->parameters['manual']['tournament_weight']) : $weights[intval($this->parameters['over39_boards'])][intval($this->parameters['tournament_rank'])]; $min_points = array( - array(0, 0, 0, 0, 50, 75, 150, 200, self::RANK_KMP => 0), - array(0, 0, 0, 0, 70, 100, 200, 300, self::RANK_KMP => 0) + array(0, 0, 0, 0, 50, 75, 150, 200, ApiPkl::RANK_KMP => 0), + array(0, 0, 0, 0, 70, 100, 200, 300, ApiPkl::RANK_KMP => 0) ); $return['min_points'] = (isset($this->parameters['manual']) && isset($this->parameters['manual']['min_points'])) ? intval($this->parameters['manual']['min_points']) : $min_points[intval($this->parameters['over39_boards'])][intval($this->parameters['tournament_rank'])]; $return['players_coefficient'] = (isset($this->parameters['manual']) && isset($this->parameters['manual']['players_coefficient'])) ? floatval($this->parameters['manual']['players_coefficient']) : 0.05; |