Performance rating unrated

This commit is contained in:
Jeroen De Meerleer 2019-05-31 10:24:06 +02:00
parent f5b0fd024d
commit a1c669780e
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
1 changed files with 5 additions and 3 deletions

View File

@ -137,12 +137,14 @@ class Player extends PlayerModel
$opponents = 0;
foreach ($this->getPairings() as $pairing) {
if (array_search($pairing->getResult(), Constants::Notplayed)) {
$opponentElo = $pairing->getOpponent()->getElo('home');
$opponentElo = $opponentElo != 0 ? $opponentElo : $this->getUnratedElo();
if (array_search(self::Won, $pairing->getResult())) {
$total += $pairing->getOpponent()->getElo('home') + 400;
$total += $opponentElo + 400;
} elseif (array_search(self::Lost, $pairing->getResult())) {
$total += $pairing->getOpponent()->getElo('home') - 400;
$total += $opponentElo - 400;
} elseif (array_search(self::Draw, $pairing->getResult())) {
$total += $pairing->getOpponent()->getElo('home');
$total += $opponentElo;
}
$opponents++;
}