adjusted the continuing anime filter 2

This commit is contained in:
pushrbx 2024-06-20 21:56:25 +01:00
parent ec0af72a19
commit 31c7790bef
No known key found for this signature in database
GPG Key ID: A16A474BBC2C91D9

View File

@ -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);