From 663951a9ccf32ca8599e84a392e8d1ee3e4e9cb5 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Tue, 18 Jun 2019 16:01:15 +0200 Subject: [PATCH] BUGFIX: Tournament::getParticipants() did not return a correct value --- CHANGELOG.md | 1 + src/Models/Tournament.php | 21 --------------------- src/Readers/Pairtwo6.php | 2 +- src/Tournament.php | 9 +++++++++ 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af60c28..3621bfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * NEW FEATURE: Soccer Kashdan (aka: kashdan using 3-1-0 scoring) * CHANGE: Deprecated `sws::class` was removed * CHANGE: Added a logo to the project +* BUGFIX: `Tournament::getParticipants()` did not return a correct value ## v1.0.2 (Released: 05-jun-2019) * NEW FEATURE: `Player::getPlayedGames()` to return the number of played games diff --git a/src/Models/Tournament.php b/src/Models/Tournament.php index 6a11f96..281104c 100644 --- a/src/Models/Tournament.php +++ b/src/Models/Tournament.php @@ -74,9 +74,6 @@ abstract class Tournament /** @var Round[] */ private $Rounds = []; - /** @var int */ - private $Participants; - /** @var string */ private $Tempo; @@ -329,24 +326,6 @@ abstract class Tournament return $this; } - /** - * @return int - */ - public function getParticipants(): int - { - return $this->Participants; - } - - /** - * @param int $Participants - * @return Tournament - */ - public function setParticipants(int $Participants): Tournament - { - $this->Participants = $Participants; - return $this; - } - /** * @return string */ diff --git a/src/Readers/Pairtwo6.php b/src/Readers/Pairtwo6.php index dbe6da8..eedcefe 100644 --- a/src/Readers/Pairtwo6.php +++ b/src/Readers/Pairtwo6.php @@ -507,7 +507,7 @@ class Pairtwo6 extends Pairtwo6Model implements ReaderInterface // Participants $length = 4; - $this->getTournament()->setParticipants($this->readData('Int', substr($swscontents, $offset, $length))); + $this->getTournament()->setBinaryData('Participants', $this->readData('Int', substr($swscontents, $offset, $length))); $offset += $length; // Fidehomol diff --git a/src/Tournament.php b/src/Tournament.php index 1c75a60..db508aa 100644 --- a/src/Tournament.php +++ b/src/Tournament.php @@ -351,4 +351,13 @@ class Tournament extends Tiebreaks } return intdiv($totalrating, $players); } + + /** + * Returns the number of participants + * + * @return int + */ + public function getParticipants(): int { + return count($this->getPlayers()); + } }