This commit is contained in:
pushrbx 2024-01-23 18:22:51 +00:00 committed by GitHub
parent 5d46bc8220
commit 734e099154
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -130,16 +130,25 @@ final class DefaultAnimeRepository extends DatabaseRepository implements AnimeRe
$finalFilter = [];
// if the premiered parameter for the filter is not null, look for those items which have a premiered attribute set,
// and equals to the parameter value, OR look for those items which doesn't have premired attribute set,
// they don't have a garbled aired string and their aired.from date is within the from-to parameters range
if ($premiered !== null) {
$finalFilter['$or'] = [
["premiered" => $premiered],
[
"premiered" => null,
"aired.string" => [
'$not' => ['$regex' => "{$from->year} to ?"]
],
...$airedFilter
]
];
} else {
$finalFilter = array_merge($finalFilter, $airedFilter);
$finalFilter["aired.string"] = [
'$not' => ['$regex' => "{$from->year} to ?"]
];
}
if (!is_null($type)) {