mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-12-22 04:11:22 +01:00
Added default elo
This commit is contained in:
parent
c9a19bbcb2
commit
b2b2f5aef8
@ -107,6 +107,12 @@ abstract class Tournament
|
||||
/** @var Tiebreak[] */
|
||||
private $Tiebreaks = [];
|
||||
|
||||
/** @var string */
|
||||
private $PriorityElo = 'Fide';
|
||||
|
||||
/** @var string */
|
||||
private $PriorityId = 'Nation';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@ -520,4 +526,39 @@ abstract class Tournament
|
||||
$this->Tiebreaks = $Tiebreaks;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPriorityElo(): string
|
||||
{
|
||||
return $this->PriorityElo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $PriorityElo
|
||||
* @return Tournament
|
||||
*/
|
||||
public function setPriorityElo(string $PriorityElo): Tournament
|
||||
{
|
||||
$this->PriorityElo = $PriorityElo;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPriorityId(): string
|
||||
{
|
||||
return $this->PriorityId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $PriorityId
|
||||
* @return Tournament
|
||||
*/
|
||||
public function setPriorityId(string $PriorityId): Tournament
|
||||
{
|
||||
$this->PriorityId = $PriorityId;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,8 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface
|
||||
}
|
||||
|
||||
$this->setTournament(new Tournament());
|
||||
|
||||
$this->getTournament()->setPriorityElo('Nation');
|
||||
$this->getTournament()->setPriorityId('Nation');
|
||||
// UserCountry
|
||||
$length = 4;
|
||||
$this->setBinaryData("UserCountry", $this->readData('Int', substr($swscontents, $offset, $length)));
|
||||
|
@ -335,7 +335,7 @@ class Tournament extends Tiebreaks
|
||||
$totalrating = 0;
|
||||
$players = 0;
|
||||
foreach ($this->getPlayers() as $player) {
|
||||
$toadd = $player->getElos()['home'];
|
||||
$toadd = $player->getElo($this->getPriorityElo());
|
||||
if ($toadd == 0) {
|
||||
$toadd = $this->getNonRatedElo();
|
||||
}
|
||||
|
@ -46,12 +46,12 @@ echo "Place: " . $sws->getTournament()->getOrganiserPlace() . PHP_EOL;
|
||||
echo "Unrated-Elo: " . $sws->getTournament()->getNonRatedElo() . PHP_EOL;
|
||||
echo "Federation: " . $sws->getTournament()->getFederation() . PHP_EOL;
|
||||
echo "Organiser: " . $sws->getTournament()->getOrganiserClubNo() . PHP_EOL;
|
||||
echo "Fide Elo P1: " . $sws->getTournament()->getPlayerById(0)->getElos()['world'] . PHP_EOL;
|
||||
echo "Fide Elo P2: " . $sws->getTournament()->getPlayerById(1)->getElos()['world'] . PHP_EOL;
|
||||
echo "Fide Elo P3: " . $sws->getTournament()->getPlayerById(2)->getElos()['world'] . PHP_EOL;
|
||||
echo "KBSB Elo P1: " . $sws->getTournament()->getPlayerById(0)->getElos()['home'] . PHP_EOL;
|
||||
echo "KBSB Elo P2: " . $sws->getTournament()->getPlayerById(1)->getElos()['home'] . PHP_EOL;
|
||||
echo "KBSB Elo P3: " . $sws->getTournament()->getPlayerById(2)->getElos()['home'] . PHP_EOL;
|
||||
echo "Fide Elo P1: " . $sws->getTournament()->getPlayerById(0)->getElo('Fide') . PHP_EOL;
|
||||
echo "Fide Elo P2: " . $sws->getTournament()->getPlayerById(1)->getElo('Fide') . PHP_EOL;
|
||||
echo "Fide Elo P3: " . $sws->getTournament()->getPlayerById(2)->getElo('Fide') . PHP_EOL;
|
||||
echo "KBSB Elo P1: " . $sws->getTournament()->getPlayerById(0)->getElo('Nation') . PHP_EOL;
|
||||
echo "KBSB Elo P2: " . $sws->getTournament()->getPlayerById(1)->getElo('Nation') . PHP_EOL;
|
||||
echo "KBSB Elo P3: " . $sws->getTournament()->getPlayerById(2)->getElo('Nation') . PHP_EOL;
|
||||
echo "Name P1: " . $sws->getTournament()->getPlayerById(0)->getName() . PHP_EOL;
|
||||
echo "Name P2: " . $sws->getTournament()->getPlayerById(1)->getName() . PHP_EOL;
|
||||
echo "Name P3: " . $sws->getTournament()->getPlayerById(2)->getName() . PHP_EOL;
|
||||
@ -75,5 +75,5 @@ echo "Tiebreak 2: " . $sws->getTournament()->getTiebreaks()[1]->getValue() . P
|
||||
echo "Tiebreak 3: " . $sws->getTournament()->getTiebreaks()[2]->getValue() . PHP_EOL;
|
||||
echo "Average Elo: " . $sws->getTournament()->getAverageElo() . PHP_EOL;
|
||||
foreach ($sws->getTournament()->getRanking() as $player) {
|
||||
echo $player->getName() . '(' . $player->getElos()['home'] . ') ' . implode(' ', $player->getTiebreaks()) . PHP_EOL;
|
||||
echo $player->getName() . '(' . $player->getElo($sws->getTournament()->getPriorityElo()) . ') ' . implode(' ', $player->getTiebreaks()) . PHP_EOL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user