From ff1c39eea2b150d3eb7f5fb7ff9cb87d444f058c Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Tue, 26 Nov 2024 15:47:42 -0800 Subject: [PATCH 1/2] Avoid 500 when adding player to an event that is already entered but has no deck There's no reason to 500 here and in fact this is a regression. This method used to look for num_rows > 0 rather than requiring an entry for deck. I just messed it up when cutting it across to new db style. --- gatherling/Models/Entry.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gatherling/Models/Entry.php b/gatherling/Models/Entry.php index b5e761f46..e45cefe7a 100644 --- a/gatherling/Models/Entry.php +++ b/gatherling/Models/Entry.php @@ -48,10 +48,10 @@ public function __construct(int $event_id, string $playername) public static function findByEventAndPlayer(int $event_id, string $playername): ?self { - $sql = 'SELECT deck FROM entries WHERE event_id = :event_id AND player = :player'; + $sql = 'SELECT player FROM entries WHERE event_id = :event_id AND player = :player'; $params = ['event_id' => $event_id, 'player' => $playername]; - $deckId = db()->optionalInt($sql, $params); - if (!$deckId) { + $player = db()->optionalString($sql, $params); + if (!$player) { return null; } return new self($event_id, $playername); From 1821bab8ff089782efc3d2f38f72e77ab9c32762 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Tue, 26 Nov 2024 15:53:04 -0800 Subject: [PATCH 2/2] Improve the appearance of player decks display --- .../templates/partials/allDecks.mustache | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/gatherling/templates/partials/allDecks.mustache b/gatherling/templates/partials/allDecks.mustache index a71cc2713..5ac110602 100644 --- a/gatherling/templates/partials/allDecks.mustache +++ b/gatherling/templates/partials/allDecks.mustache @@ -1,22 +1,17 @@

Decks marked with a * are not legal under current format.

-
-
- - - - - {{#decks}} - - - - - - - {{/decks}} -
{{upPlayer}}'S DECKS
{{#medalSrc}}Medal{{/medalSrc}}{{recordString}}{{#deckLink}}{{> deckLink}}{{/deckLink}}{{^isValid}}*{{/isValid}}{{eventName}}
-
-
-
-
+
+ + + + + {{#decks}} + + + + + + + {{/decks}} +
{{upPlayer}}'S DECKS
{{#medalSrc}}Medal{{/medalSrc}}{{recordString}}{{#deckLink}}{{> deckLink}}{{/deckLink}}{{^isValid}}*{{/isValid}}{{eventName}}