mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-12-24 13:20:58 +01:00
Compare commits
No commits in common. "b1fe9d20c3cda346fc75b10a3e40fcb0677b29af" and "4112cc70d677d862297d6f54f9b480b0c54ca9bd" have entirely different histories.
b1fe9d20c3
...
4112cc70d6
@ -15,7 +15,6 @@ namespace JeroenED\Libpairtwo;
|
|||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use JeroenED\Libpairtwo\Enums\Gender;
|
use JeroenED\Libpairtwo\Enums\Gender;
|
||||||
use JeroenED\Libpairtwo\Enums\Result;
|
|
||||||
use JeroenED\Libpairtwo\Enums\Title;
|
use JeroenED\Libpairtwo\Enums\Title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -228,19 +227,15 @@ class Player
|
|||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function calculatePoints(int $round = -1, array $custompoints = []): float
|
public function calculatePoints(int $round = -1): float
|
||||||
{
|
{
|
||||||
$points = 0;
|
$points = 0;
|
||||||
foreach ($this->Pairings as $key => $pairing) {
|
foreach ($this->Pairings as $key => $pairing) {
|
||||||
if ($key < $round || $round == -1) {
|
if ($key < $round || $round == -1) {
|
||||||
if ($pairing->Result == Result::WON_BYE) {
|
if (array_search($pairing->Result, Constants::WON) !== false) {
|
||||||
$points += (isset($this->CustomPoints[ 'bye' ])) ? $custompoints[ 'bye' ] : 1;
|
$points = $points + 1;
|
||||||
} elseif (array_search($pairing->Result, Constants::WON) !== false) {
|
|
||||||
$points += (isset($custompoints[ 'win' ])) ? $custompoints[ 'win' ] : 1;
|
|
||||||
} elseif (array_search($pairing->Result, Constants::DRAW) !== false) {
|
} elseif (array_search($pairing->Result, Constants::DRAW) !== false) {
|
||||||
$points += (isset($custompoints[ 'draw' ])) ? $custompoints[ 'draw' ] : 0.5;
|
$points = $points + 0.5;
|
||||||
} elseif (array_search($pairing->Result, Constants::LOST) !== false) {
|
|
||||||
$points += (isset($custompoints[ 'loss' ])) ? $custompoints[ 'loss' ] : 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,11 +274,11 @@ class Swar5 implements ReaderInterface
|
|||||||
$this->Tournament->SW_AmerPresence = $this->readData('Int', $swshandle);
|
$this->Tournament->SW_AmerPresence = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->Plusieurs = $this->readData('Int', $swshandle);
|
$this->Tournament->Plusieurs = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->FirstTable = $this->readData('Int', $swshandle);
|
$this->Tournament->FirstTable = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->CustomPoints['win'] = $this->readData('Int', $swshandle) / 4;
|
$this->Tournament->SW321_Win = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->CustomPoints['draw'] = $this->readData('Int', $swshandle) / 4;
|
$this->Tournament->SW321_Nul = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->CustomPoints['loss'] = $this->readData('Int', $swshandle) / 4;
|
$this->Tournament->SW321_Los = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->CustomPoints['bye'] = $this->readData('Int', $swshandle) / 4;
|
$this->Tournament->SW321_Bye = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->CustomPoints['absent'] = $this->readData('Int', $swshandle) / 4;
|
$this->Tournament->SW321_Pre = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->EloUsed = $this->readData('Int', $swshandle);
|
$this->Tournament->EloUsed = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->TournoiStd = $this->readData('Int', $swshandle);
|
$this->Tournament->TournoiStd = $this->readData('Int', $swshandle);
|
||||||
$this->Tournament->TbPersonel = $this->readData('Int', $swshandle);
|
$this->Tournament->TbPersonel = $this->readData('Int', $swshandle);
|
||||||
|
@ -204,13 +204,6 @@ class Tournament
|
|||||||
*/
|
*/
|
||||||
public $Tiebreaks = [];
|
public $Tiebreaks = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* Custom points for the tournament
|
|
||||||
*
|
|
||||||
* @var float[]
|
|
||||||
*/
|
|
||||||
public $CustomPoints = ['win' => 1, 'draw' => 0.5, 'loss' => 0, 'bye' => 1, 'absent' => 0];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The year or season the tournament is held or is count for
|
* The year or season the tournament is held or is count for
|
||||||
*
|
*
|
||||||
@ -706,7 +699,7 @@ class Tournament
|
|||||||
*/
|
*/
|
||||||
private function calculatePoints(Player $player): float
|
private function calculatePoints(Player $player): float
|
||||||
{
|
{
|
||||||
return $player->calculatePoints(-1, $this->CustomPoints);
|
return $player->calculatePoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user