From 8b20cfd78805c927ad2e8a2a66d2d8f9e32f919f Mon Sep 17 00:00:00 2001 From: Leon Date: Fri, 30 Jan 2026 12:26:35 +0100 Subject: [PATCH] feat: try fix ci --- app/Http/Controllers/HuntsController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/HuntsController.php b/app/Http/Controllers/HuntsController.php index ae74bd5..6f85083 100644 --- a/app/Http/Controllers/HuntsController.php +++ b/app/Http/Controllers/HuntsController.php @@ -77,10 +77,15 @@ class HuntsController extends Controller $active = filter_var($request->query('active'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); if ($active === true) { + // Hunt actif = démarré ET (pas terminé OU pas de date de fin) $filters[] = "start_at_timestamp <= {$now}"; - $filters[] = "(end_at_timestamp >= {$now} OR end_at_timestamp IS NULL)"; - } else { - $filters[] = "(start_at_timestamp > {$now} OR end_at_timestamp < {$now})"; + // Meilisearch : la syntaxe est 'field EXISTS' et non 'EXISTS field' + // Un hunt est actif si end_at_timestamp n'existe pas OU >= now + $filters[] = "(end_at_timestamp >= {$now} OR NOT end_at_timestamp EXISTS)"; + } elseif ($active === false) { + // Hunt non actif = pas encore commencé OU (déjà terminé ET a une date de fin) + // Si pas de end_at_timestamp, le hunt ne peut pas être terminé + $filters[] = "(start_at_timestamp > {$now} OR (end_at_timestamp < {$now} AND end_at_timestamp EXISTS))"; } }