diff --git a/src/Player.php b/src/Player.php index 173e8d2..a0995b2 100644 --- a/src/Player.php +++ b/src/Player.php @@ -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++; }