Implemented reading out round dates

This commit is contained in:
Jeroen De Meerleer 2019-02-12 18:05:19 +01:00
parent 512aebdc70
commit ce6e501043
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
3 changed files with 10 additions and 2 deletions

View File

@ -472,7 +472,10 @@ class Sws extends SwsModel
// Round dates // Round dates
for ($i = 0; $i < $sws->getTournament()->getNoOfRounds(); $i++) { for ($i = 0; $i < $sws->getTournament()->getNoOfRounds(); $i++) {
$length = 4; $length = 4;
$sws->setBinaryData('Round_' . $i . '_date', self::ReadData('Date', substr($swscontents, $offset, $length))); $round = new Round();
$round->setRoundNo($i);
$round->setDate(self::ReadData('Date', substr($swscontents, $offset, $length)));
$sws->getTournament()->addRound($round);
$offset += $length; $offset += $length;
} }

View File

@ -172,6 +172,7 @@ class Tournament extends TournamentModel
return false; return false;
} }
$games = $this->getRounds()[$round]->getGames(); $games = $this->getRounds()[$round]->getGames();
if(is_null($games)) return false;
foreach ($games as $roundgame) { foreach ($games as $roundgame) {
if ($roundgame->getWhite() == $game->getWhite() && if ($roundgame->getWhite() == $game->getWhite() &&
$roundgame->getBlack() == $game->getBlack() && $roundgame->getBlack() == $game->getBlack() &&

View File

@ -42,7 +42,7 @@ echo "End-Date: " . $sws->getTournament()->getEndDate()->format('d/m/Y') . P
echo "System: " . $sws->getTournament()->getSystem()->getKey() . PHP_EOL; echo "System: " . $sws->getTournament()->getSystem()->getKey() . PHP_EOL;
echo "Place: " . $sws->getTournament()->getOrganiserPlace() . PHP_EOL; echo "Place: " . $sws->getTournament()->getOrganiserPlace() . PHP_EOL;
echo "Unrated-Elo: " . $sws->getTournament()->getNonRatedElo() . PHP_EOL; echo "Unrated-Elo: " . $sws->getTournament()->getNonRatedElo() . PHP_EOL;
echo "Federatiop: " . $sws->getTournament()->getFederation() . PHP_EOL; echo "Federation: " . $sws->getTournament()->getFederation() . PHP_EOL;
echo "Organiser: " . $sws->getTournament()->getOrganiserClubNo() . PHP_EOL; echo "Organiser: " . $sws->getTournament()->getOrganiserClubNo() . PHP_EOL;
echo "Fide Elo P1: " . $sws->getTournament()->getPlayerById(0)->getFideElo() . PHP_EOL; echo "Fide Elo P1: " . $sws->getTournament()->getPlayerById(0)->getFideElo() . PHP_EOL;
echo "Fide Elo P2: " . $sws->getTournament()->getPlayerById(1)->getFideElo() . PHP_EOL; echo "Fide Elo P2: " . $sws->getTournament()->getPlayerById(1)->getFideElo() . PHP_EOL;
@ -56,3 +56,7 @@ echo "Name P3: " . $sws->getTournament()->getPlayerById(2)->getName() . PHP
echo "Absent P1: " . $sws->getTournament()->getPlayerById(0)->getAbsent() . PHP_EOL; echo "Absent P1: " . $sws->getTournament()->getPlayerById(0)->getAbsent() . PHP_EOL;
echo "Absent P2: " . $sws->getTournament()->getPlayerById(1)->getAbsent() . PHP_EOL; echo "Absent P2: " . $sws->getTournament()->getPlayerById(1)->getAbsent() . PHP_EOL;
echo "Absent P3: " . $sws->getTournament()->getPlayerById(2)->getAbsent() . PHP_EOL; echo "Absent P3: " . $sws->getTournament()->getPlayerById(2)->getAbsent() . PHP_EOL;
echo "Date Round 1: " . $sws->getTournament()->getRoundByNo(0)->getDate()->format('d/m/Y') . PHP_EOL;
echo "Date Round 2: " . $sws->getTournament()->getRoundByNo(1)->getDate()->format('d/m/Y') . PHP_EOL;
echo "Date Round 3: " . $sws->getTournament()->getRoundByNo(2)->getDate()->format('d/m/Y') . PHP_EOL;