From 31c7790bef0d66ac9bdca46519c5ed83b5eb0c2b Mon Sep 17 00:00:00 2001 From: pushrbx Date: Thu, 20 Jun 2024 21:56:25 +0100 Subject: [PATCH] adjusted the continuing anime filter 2 --- app/Repositories/DefaultAnimeRepository.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/Repositories/DefaultAnimeRepository.php b/app/Repositories/DefaultAnimeRepository.php index cf5286f..786d75b 100644 --- a/app/Repositories/DefaultAnimeRepository.php +++ b/app/Repositories/DefaultAnimeRepository.php @@ -145,11 +145,11 @@ final class DefaultAnimeRepository extends DatabaseRepository implements AnimeRe ]; if ($includeContinuingItems) { // 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. + // long running shows $finalFilter['$or'][] = [ 'aired.from' => ['$lte' => $from->toAtomString()], 'aired.to' => null, + 'episodes' => null, 'airing' => true ]; // We want to include those which are currently airing, and their aired.to is past the date of the @@ -159,6 +159,16 @@ final class DefaultAnimeRepository extends DatabaseRepository implements AnimeRe 'aired.to' => ['$gte' => $from->toAtomString()], 'airing' => true ]; + // In many cases MAL doesn't show the date until an airing show is going to be aired. So we need to get + // clever here. + // We want to include those shows which have started in previous season only (not before) and it's going + // to continue in the current season. + $finalFilter['$or'][] = [ + 'aired.from' => ['$lte' => $from->toAtomString()], + 'aired.to' => null, + 'episodes' => ['$gte' => 14], + 'airing' => true + ]; } } else { $finalFilter = array_merge($finalFilter, $airedFilter);