Skip to content

Commit

Permalink
adjusted the continuing anime filter 2
Browse files Browse the repository at this point in the history
  • Loading branch information
pushrbx committed Jun 20, 2024
1 parent ec0af72 commit 31c7790
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/Repositories/DefaultAnimeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ public function getItemsBySeason(
];
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
Expand All @@ -159,6 +159,16 @@ public function getItemsBySeason(
'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);
Expand Down

0 comments on commit 31c7790

Please sign in to comment.