From ec0af72a197cabb4816d8b7309b9e3fc6724093d Mon Sep 17 00:00:00 2001 From: pushrbx Date: Thu, 20 Jun 2024 18:04:38 +0100 Subject: [PATCH] adjusted the continuing anime filter --- app/Repositories/DefaultAnimeRepository.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Repositories/DefaultAnimeRepository.php b/app/Repositories/DefaultAnimeRepository.php index 76d9a349..cf5286f2 100644 --- a/app/Repositories/DefaultAnimeRepository.php +++ b/app/Repositories/DefaultAnimeRepository.php @@ -144,9 +144,19 @@ public function getItemsBySeason( ], ]; if ($includeContinuingItems) { - // this condition will include "continuing" items from previous seasons + // these conditions will include "continuing" items from previous seasons + // We want to include those which are currently airing, and their aired.to is unknown, and their start + // date is before when the current season began. $finalFilter['$or'][] = [ 'aired.from' => ['$lte' => $from->toAtomString()], + 'aired.to' => null, + 'airing' => true + ]; + // We want to include those which are currently airing, and their aired.to is past the date of the + // current season start. + $finalFilter['$or'][] = [ + 'aired.from' => ['$lte' => $from->toAtomString()], + 'aired.to' => ['$gte' => $from->toAtomString()], 'airing' => true ]; }