diff options
author | emkael <emkael@tlen.pl> | 2025-02-13 00:29:14 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2025-02-13 01:29:58 +0100 |
commit | 06c0a51b191c35905c819ae839dcb357a446e500 (patch) | |
tree | ae98ef6491a208790bd4e672283c42b9d68027da | |
parent | 88b7b54c4fc6505a324fcc2bdae63f59ffb425f6 (diff) |
1.25x multipler applies to points for 1st place in a team event even if min_points is set
(RegKlas amendment: 12.02.2025)
-rw-r--r-- | http/api-inc.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/http/api-inc.php b/http/api-inc.php index cb26c69..9b5a6ec 100644 --- a/http/api-inc.php +++ b/http/api-inc.php @@ -38,7 +38,7 @@ function run($parameters) { '2' => 'ApiPklV2', // RegKMP 2020.01.01 '3' => 'ApiPklV3', // local BNET 2020.05.01 '3.1' => 'ApiPklV3_1', // local BNET changes from 2021.01.10 - '4.0' => 'ApiPklV4', // RegKlas 2025.01.01 + '4.0' => 'ApiPklV4', // RegKlas 2025.01.01 (2025.02.12) '_default' => 'ApiPklV4' ); $version = isset($parameters['version']) ? $parameters['version'] : '_default'; @@ -59,6 +59,9 @@ class ApiPkl { const RANK_KMP = 101; const RANK_BNET = 102; + // points for 1st place are 1.25x for teams + const TEAMS_BONUS = 0.25; + protected $parameters; function __construct($parameters) { @@ -212,10 +215,14 @@ class ApiPkl { return 0.0; } + protected function _get_type_multiplier() { + return (1 + static::TEAMS_BONUS * ($this->parameters['type'] > 2)); + } + protected function _get_max_points() { return safe_ceil(max( $this->parameters['min_points'], - (1 + 0.25 * ($this->parameters['type'] > 2)) * (max(0.15, $this->parameters['title_sum'] / $this->parameters['players']) * $this->parameters['tournament_weight'] + $this->parameters['players_coefficient'] * $this->parameters['contestants'] * $this->parameters['type']) + $this->_get_type_multiplier() * (max(0.15, $this->parameters['title_sum'] / $this->parameters['players']) * $this->parameters['tournament_weight'] + $this->parameters['players_coefficient'] * $this->parameters['contestants'] * $this->parameters['type']) )); } @@ -332,7 +339,9 @@ class ApiPklV4 extends ApiPklV3_1 { protected function _get_max_points() { if ($this->parameters['min_points']) { - return $this->parameters['min_points']; + // 2025.02.12 amendment: + // RodzajTurnieju multipler applies to number of points for 1st place + return $this->parameters['min_points'] * $this->_get_type_multiplier(); } return parent::_get_max_points(); } |