From 721cb1f74283ff4b8020a21da5c851c6eed009d0 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Wed, 1 May 2019 20:13:01 +0200 Subject: [PATCH] Updated Showing the pairings of a specific round (markdown) --- Showing-the-pairings-of-a-specific-round.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Showing-the-pairings-of-a-specific-round.md b/Showing-the-pairings-of-a-specific-round.md index 19423be..9297de0 100644 --- a/Showing-the-pairings-of-a-specific-round.md +++ b/Showing-the-pairings-of-a-specific-round.md @@ -16,15 +16,16 @@ use JeroenED\Libpairtwo\Enums\Result; $sws = Sws::readSws('mycompetition.sws'); $tournament = $sws->getTournament(); $pairings = $tournament->getRoundByNo($_GET['round'])->getPairings(); + foreach($pairings as $pairing) { $player = $pairing->getPlayer()->getName(); if (!is_null($pairing->getOpponent())) { - $opponent = $pairing->getOpponent()->getName(); - $color = $pairing->getColor()->getKey(); - echo $player . ' against ' . $opponent . ' using ' . $color . PHP_EOL; - } elseif ($pairing->getResult() == Result::bye ) { - echo $player . ' is bye' . PHP_EOL; - } elseif ($pairing->getResult() == Result::absent ) { - echo $player . ' is absent' . PHP_EOL; + $opponent = $pairing->getOpponent()->getName(); + $color = $pairing->getColor()->getKey(); + echo $player . ' ' . $pairing->getResult()->getKey() . ' against ' . $opponent . ' using ' . $color . PHP_EOL; + } elseif ($pairing->getResult() == Result::bye) { + echo $player . ' is bye' . PHP_EOL; + } elseif ($pairing->getResult() == Result::absent) { + echo $player . ' is absent' . PHP_EOL; } } \ No newline at end of file