Added 'presence' points to player scoring

The scoring system in the Player class has been updated. Now, players will receive additional 'presence' points for each round they participate in, regardless of the outcome (win, loss, draw, bye or absent). The number of 'presence' points is customizable and defaults to zero if not set.
This commit is contained in:
Jeroen De Meerleer 2024-09-19 11:50:08 +02:00
parent ff8d372a8f
commit cb1b5c29be
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6

View File

@ -235,14 +235,18 @@ class Player
if ($key < $round || $round == -1) {
if ($pairing->Result == Result::WON_BYE) {
$points += (isset($custompoints[ 'bye' ])) ? $custompoints[ 'bye' ] : 1;
$points += (isset($custompoints[ 'presence' ])) ? $custompoints[ 'presence' ] : 0;
} else if ($pairing->Result == Result::ABSENT) {
$points += (isset($custompoints[ 'absent' ])) ? $custompoints[ 'absent' ] : 0;
} elseif (array_search($pairing->Result, Constants::WON) !== false) {
$points += (isset($custompoints[ 'win' ])) ? $custompoints[ 'win' ] : 1;
$points += (isset($custompoints[ 'presence' ])) ? $custompoints[ 'presence' ] : 0;
} elseif (array_search($pairing->Result, Constants::DRAW) !== false) {
$points += (isset($custompoints[ 'draw' ])) ? $custompoints[ 'draw' ] : 0.5;
$points += (isset($custompoints[ 'presence' ])) ? $custompoints[ 'presence' ] : 0;
} elseif (array_search($pairing->Result, Constants::LOST) !== false) {
$points += (isset($custompoints[ 'loss' ])) ? $custompoints[ 'loss' ] : 0;
$points += (isset($custompoints[ 'presence' ])) ? $custompoints[ 'presence' ] : 0;
}
}
}