mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-25 15:57:41 +01:00
Performance rating unrated
This commit is contained in:
parent
f5b0fd024d
commit
a1c669780e
@ -137,12 +137,14 @@ class Player extends PlayerModel
|
|||||||
$opponents = 0;
|
$opponents = 0;
|
||||||
foreach ($this->getPairings() as $pairing) {
|
foreach ($this->getPairings() as $pairing) {
|
||||||
if (array_search($pairing->getResult(), Constants::Notplayed)) {
|
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())) {
|
if (array_search(self::Won, $pairing->getResult())) {
|
||||||
$total += $pairing->getOpponent()->getElo('home') + 400;
|
$total += $opponentElo + 400;
|
||||||
} elseif (array_search(self::Lost, $pairing->getResult())) {
|
} elseif (array_search(self::Lost, $pairing->getResult())) {
|
||||||
$total += $pairing->getOpponent()->getElo('home') - 400;
|
$total += $opponentElo - 400;
|
||||||
} elseif (array_search(self::Draw, $pairing->getResult())) {
|
} elseif (array_search(self::Draw, $pairing->getResult())) {
|
||||||
$total += $pairing->getOpponent()->getElo('home');
|
$total += $opponentElo;
|
||||||
}
|
}
|
||||||
$opponents++;
|
$opponents++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user