From c403c2f5becf38d87d711c7e676ad15956e6c6ca Mon Sep 17 00:00:00 2001
From: Jeroen De Meerleer
Date: Sun, 22 Nov 2020 16:40:10 +0100
Subject: [PATCH] NEW FEATURE: reading out categories from pairtwo-6
---
dist/template.php | 42 ++++++++++++--
res/categories_test.sws | Bin 0 -> 12023 bytes
src/Readers/Pairtwo6.php | 13 +++--
src/Tournament.php | 44 ++++++++++++++-
tests/ReadSws_test.php | 116 ++++++++++++++++++++-------------------
5 files changed, 147 insertions(+), 68 deletions(-)
create mode 100644 res/categories_test.sws
diff --git a/dist/template.php b/dist/template.php
index 9cd3e19..345760b 100644
--- a/dist/template.php
+++ b/dist/template.php
@@ -49,8 +49,8 @@ foreach ($reader->Tournament->Rounds as $round) {
foreach ($round->GamesByBoard as $game) {
echo '' . PHP_EOL;
echo '' . ($game->Board + 1) . ' | ' . PHP_EOL;
- echo '' . $game->White->Player->Name . ' | ' . PHP_EOL;
- echo '' . $game->Black->Player->Name . ' | ' . PHP_EOL;
+ echo '' . $game->White->Player->Name . ' (' . $game->White->Player->getElo($reader->Tournament->PriorityElo) . ') | ' . PHP_EOL;
+ echo '' . $game->Black->Player->Name . ' (' . $game->Black->Player->getElo($reader->Tournament->PriorityElo) . ') | ' . PHP_EOL;
echo '' . $game->Result->getValue() . ' | ' . PHP_EOL;
echo '
' . PHP_EOL;
}
@@ -73,11 +73,11 @@ foreach ($reader->Tournament->Rounds as $round) {
echo '
' . PHP_EOL;
}
-echo 'Rankings
' . PHP_EOL;
+echo 'Global Rankings
' . PHP_EOL;
echo '' . PHP_EOL;
echo '' . PHP_EOL;
-echo ' | Name (elo) | ' . PHP_EOL;
-foreach ($reader->Tournament->TieBreaks as $tiebreak) {
+echo '
---|
| Name (elo) | Category | ' . PHP_EOL;
+foreach ($reader->Tournament->Tiebreaks as $tiebreak) {
echo '' . $tiebreak->getValue() . ' | ' . PHP_EOL;
}
echo '
' . PHP_EOL;
@@ -88,13 +88,43 @@ $rank = 1;
foreach ($reader->Tournament->Ranking as $player) {
echo '' . PHP_EOL;
echo '' . $rank . ' | ' . PHP_EOL;
- echo '' . $player->Name . '(' . $player->getElo($reader->Tournament->PriorityElo) . ') | ' . PHP_EOL;
+ echo '' . $player->Name . ' (' . $player->getElo($reader->Tournament->PriorityElo) . ') | ' . PHP_EOL;
+ echo '' . $player->Category . ' | ' . PHP_EOL;
echo '' . implode(' | ', $player->Tiebreaks) . ' | ' . PHP_EOL;
echo '
' . PHP_EOL;
$rank++;
}
echo '' . PHP_EOL;
echo '
' . PHP_EOL;
+?>
+
+Rankings per Category' . PHP_EOL;
+
+foreach($reader->Tournament->Categories as $category) {
+ echo '' . PHP_EOL;
+ echo '' . $category . '';
+ echo '' . PHP_EOL;
+ echo ' | Name (elo) | ' . PHP_EOL;
+ foreach ($reader->Tournament->Tiebreaks as $tiebreak) {
+ echo '' . $tiebreak->getValue() . ' | ' . PHP_EOL;
+ }
+ echo '
' . PHP_EOL;
+ echo '' . PHP_EOL;
+ echo '' . PHP_EOL;
+
+ $rank = 1;
+ foreach ($reader->Tournament->RankingForCategory($category) as $player) {
+ echo '' . PHP_EOL;
+ echo '' . $rank . ' | ' . PHP_EOL;
+ echo '' . $player->Name . ' (' . $player->getElo($reader->Tournament->PriorityElo) . ') | ' . PHP_EOL;
+ echo '' . implode(' | ', $player->Tiebreaks) . ' | ' . PHP_EOL;
+ echo '
' . PHP_EOL;
+ $rank++;
+ }
+ echo '' . PHP_EOL;
+ echo '
' . PHP_EOL;
+}
?>