From 1f3e381049b39947abd7a0c6ed85d94ad07ee766 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Tue, 18 Jun 2019 15:57:42 +0200 Subject: [PATCH 1/2] Reimplemented getParticipants Possibly historic field that became unused --- src/Models/Tournament.php | 21 --------------------- src/Readers/Pairtwo6.php | 2 +- src/Tournament.php | 9 +++++++++ 3 files changed, 10 insertions(+), 22 deletions(-) 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()); + } } From d03bfd64a395deb97c19bc964b92a839714afe8e Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Tue, 18 Jun 2019 16:00:00 +0200 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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