mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix: series displayed an empty season with series list/request modal (#3147)
* fix: series would show an empty season on season list or tv request modal * fix: request more would show even if all requestable seasons are already requested * fix: will check if request or season length is longer
This commit is contained in:
@@ -232,7 +232,9 @@ const TvRequestModal = ({
|
|||||||
|
|
||||||
const getAllSeasons = (): number[] => {
|
const getAllSeasons = (): number[] => {
|
||||||
return (data?.seasons ?? [])
|
return (data?.seasons ?? [])
|
||||||
.filter((season) => season.seasonNumber !== 0)
|
.filter(
|
||||||
|
(season) => season.seasonNumber !== 0 && season.episodeCount !== 0
|
||||||
|
)
|
||||||
.map((season) => season.seasonNumber);
|
.map((season) => season.seasonNumber);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -555,7 +557,10 @@ const TvRequestModal = ({
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody className="divide-y divide-gray-700">
|
<tbody className="divide-y divide-gray-700">
|
||||||
{data?.seasons
|
{data?.seasons
|
||||||
.filter((season) => season.seasonNumber !== 0)
|
.filter(
|
||||||
|
(season) =>
|
||||||
|
season.seasonNumber !== 0 && season.episodeCount !== 0
|
||||||
|
)
|
||||||
.map((season) => {
|
.map((season) => {
|
||||||
const seasonRequest = getSeasonRequest(
|
const seasonRequest = getSeasonRequest(
|
||||||
season.seasonNumber
|
season.seasonNumber
|
||||||
|
@@ -38,7 +38,7 @@ import {
|
|||||||
FilmIcon,
|
FilmIcon,
|
||||||
PlayIcon,
|
PlayIcon,
|
||||||
} from '@heroicons/react/24/outline';
|
} from '@heroicons/react/24/outline';
|
||||||
import { ChevronUpIcon } from '@heroicons/react/24/solid';
|
import { ChevronDownIcon } from '@heroicons/react/24/solid';
|
||||||
import type { RTRating } from '@server/api/rottentomatoes';
|
import type { RTRating } from '@server/api/rottentomatoes';
|
||||||
import { ANIME_KEYWORD_ID } from '@server/api/themoviedb/constants';
|
import { ANIME_KEYWORD_ID } from '@server/api/themoviedb/constants';
|
||||||
import { IssueStatus } from '@server/constants/issue';
|
import { IssueStatus } from '@server/constants/issue';
|
||||||
@@ -193,7 +193,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const seasonCount = data.seasons.filter(
|
const seasonCount = data.seasons.filter(
|
||||||
(season) => season.seasonNumber !== 0
|
(season) => season.seasonNumber !== 0 && season.episodeCount !== 0
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
if (seasonCount) {
|
if (seasonCount) {
|
||||||
@@ -221,25 +221,37 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const isComplete =
|
const getAllRequestedSeasons = (is4k: boolean): number[] => {
|
||||||
seasonCount <=
|
const requestedSeasons = (data?.mediaInfo?.requests ?? [])
|
||||||
(
|
.filter(
|
||||||
data.mediaInfo?.seasons.filter(
|
(request) =>
|
||||||
(season) =>
|
request.is4k === is4k &&
|
||||||
season.status === MediaStatus.AVAILABLE ||
|
request.status !== MediaRequestStatus.DECLINED
|
||||||
season.status === MediaStatus.PARTIALLY_AVAILABLE
|
)
|
||||||
) ?? []
|
.reduce((requestedSeasons, request) => {
|
||||||
).length;
|
return [
|
||||||
|
...requestedSeasons,
|
||||||
|
...request.seasons.map((sr) => sr.seasonNumber),
|
||||||
|
];
|
||||||
|
}, [] as number[]);
|
||||||
|
|
||||||
const is4kComplete =
|
const availableSeasons = (data?.mediaInfo?.seasons ?? [])
|
||||||
seasonCount <=
|
.filter(
|
||||||
(
|
|
||||||
data.mediaInfo?.seasons.filter(
|
|
||||||
(season) =>
|
(season) =>
|
||||||
season.status4k === MediaStatus.AVAILABLE ||
|
(season[is4k ? 'status4k' : 'status'] === MediaStatus.AVAILABLE ||
|
||||||
season.status4k === MediaStatus.PARTIALLY_AVAILABLE
|
season[is4k ? 'status4k' : 'status'] ===
|
||||||
) ?? []
|
MediaStatus.PARTIALLY_AVAILABLE ||
|
||||||
).length;
|
season[is4k ? 'status4k' : 'status'] === MediaStatus.PROCESSING) &&
|
||||||
|
!requestedSeasons.includes(season.seasonNumber)
|
||||||
|
)
|
||||||
|
.map((season) => season.seasonNumber);
|
||||||
|
|
||||||
|
return [...requestedSeasons, ...availableSeasons];
|
||||||
|
};
|
||||||
|
|
||||||
|
const isComplete = seasonCount <= getAllRequestedSeasons(false).length;
|
||||||
|
|
||||||
|
const is4kComplete = seasonCount <= getAllRequestedSeasons(true).length;
|
||||||
|
|
||||||
const streamingProviders =
|
const streamingProviders =
|
||||||
data?.watchProviders?.find((provider) => provider.iso_3166_1 === region)
|
data?.watchProviders?.find((provider) => provider.iso_3166_1 === region)
|
||||||
@@ -539,6 +551,10 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
|||||||
) && r.is4k
|
) && r.is4k
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (season.episodeCount === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Disclosure key={`season-discoslure-${season.seasonNumber}`}>
|
<Disclosure key={`season-discoslure-${season.seasonNumber}`}>
|
||||||
{({ open }) => (
|
{({ open }) => (
|
||||||
@@ -709,7 +725,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<ChevronUpIcon
|
<ChevronDownIcon
|
||||||
className={`${
|
className={`${
|
||||||
open ? 'rotate-180 transform' : ''
|
open ? 'rotate-180 transform' : ''
|
||||||
} h-6 w-6 text-gray-500`}
|
} h-6 w-6 text-gray-500`}
|
||||||
|
Reference in New Issue
Block a user