From e66dbfa447d6ceed10325f43c9ba80c1da7a97fb Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Tue, 3 Dec 2024 00:39:34 -0800 Subject: [PATCH] Remove unnecessary data loading and passing in host control panel We used to display this stuff but I change the display. --- gatherling/Views/Components/HostEvents.php | 8 ++++---- gatherling/Views/Pages/EventList.php | 22 ++++------------------ gatherling/templates/eventList.mustache | 1 - 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/gatherling/Views/Components/HostEvents.php b/gatherling/Views/Components/HostEvents.php index f9fd73682..8510326ac 100644 --- a/gatherling/Views/Components/HostEvents.php +++ b/gatherling/Views/Components/HostEvents.php @@ -8,17 +8,17 @@ class HostEvents extends Component { - /** @var list */ + /** @var list */ public array $pendingEvents = []; - /** @var list */ + /** @var list */ public array $activeEvents = []; public bool $hasPendingEvents; public bool $hasActiveEvents; /** - * @param list $pendingEvents - * @param list $activeEvents + * @param list $pendingEvents + * @param list $activeEvents */ public function __construct(array $pendingEvents, array $activeEvents) { diff --git a/gatherling/Views/Pages/EventList.php b/gatherling/Views/Pages/EventList.php index d35774d24..ceabb3627 100644 --- a/gatherling/Views/Pages/EventList.php +++ b/gatherling/Views/Pages/EventList.php @@ -11,7 +11,6 @@ use Gatherling\Views\Components\HostEvents; use Gatherling\Views\Components\SeasonDropMenu; use Gatherling\Views\Components\SeriesDropMenu; -use Gatherling\Views\Components\Time; use function Gatherling\Helpers\db; use function Gatherling\Helpers\get; @@ -24,9 +23,9 @@ class EventList extends Page public SeriesDropMenu $seriesDropMenu; public SeasonDropMenu $seasonDropMenu; public bool $hasPlayerSeries; - /** @var list */ + /** @var list */ public array $upcomingEvents; - /** @var list */ + /** @var list */ public array $pastEvents; public bool $hasMore; @@ -39,31 +38,18 @@ public function __construct(string $seriesName, string $format, ?int $season) $events = queryEvents($player, $playerSeries, $seriesName, $format, $season); $hasMore = count($events) == 100; - $kvalueMap = [ - 0 => 'none', - 8 => 'Casual', - 16 => 'Regular', - 24 => 'Large', - 32 => 'Championship', - ]; - $pendingEvents = $activeEvents = $upcomingEvents = $pastEvents = $seriesShown = []; foreach ($events as $event) { $seriesShown[] = $event->series; $baseLink = 'event.php?name=' . rawurlencode($event->name) . '&view='; $eventInfo = [ 'name' => $event->name, - 'format' => $event->format, 'players' => $event->players, - 'host' => $event->host, 'start' => $event->start, 'active' => $event->active, 'finalized' => $event->finalized, - 'cohost' => $event->cohost ?? '', 'series' => $event->series, - 'kvalueDisplay' => $kvalueMap[$event->kvalue] ?? '', 'link' => 'event.php?name=' . rawurlencode($event->name), - 'isOngoing' => $event->finalized == 0 && $event->active == 1, 'currentRound' => $event->current_round, 'settingsLink' => "{$baseLink}settings", 'registrationLink' => "{$baseLink}reg", @@ -106,8 +92,8 @@ public function __construct(string $seriesName, string $format, ?int $season) function queryEvents(Player $player, array $playerSeries, string $seriesName, string $format, ?int $season): array { $sql = ' - SELECT e.name, e.format, COUNT(DISTINCT n.player) AS players, e.host, e.start, - e.active, e.finalized, e.cohost, e.series, e.kvalue, e.current_round + SELECT e.name, COUNT(DISTINCT n.player) AS players, e.start, e.active, + e.finalized, e.series, e.current_round FROM events e LEFT JOIN entries AS n ON n.event_id = e.id WHERE (e.host = :player_name OR e.cohost = :player_name OR e.series IN (:series_names))'; diff --git a/gatherling/templates/eventList.mustache b/gatherling/templates/eventList.mustache index 0c969628f..011256414 100644 --- a/gatherling/templates/eventList.mustache +++ b/gatherling/templates/eventList.mustache @@ -70,7 +70,6 @@ {{#pastEvents}} - {{name}} {{players}}