diff --git a/server/api/rottentomatoes.ts b/server/api/rottentomatoes.ts index c75f203bf..7c1c5985b 100644 --- a/server/api/rottentomatoes.ts +++ b/server/api/rottentomatoes.ts @@ -116,7 +116,7 @@ class RottenTomatoes { public async getTVRatings( name: string, - year: number + year?: number ): Promise { try { const response = await this.axios.get( @@ -126,9 +126,13 @@ class RottenTomatoes { } ); - const tvshow = response.data.tvSeries.find( - (series) => series.startYear === year - ); + let tvshow: RTTvSearchResult | undefined = response.data.tvSeries[0]; + + if (year) { + tvshow = response.data.tvSeries.find( + (series) => series.startYear === year + ); + } if (!tvshow) { return null; diff --git a/server/routes/tv.ts b/server/routes/tv.ts index 7e8b06257..be3915b03 100644 --- a/server/routes/tv.ts +++ b/server/routes/tv.ts @@ -106,7 +106,7 @@ tvRoutes.get('/:id/ratings', async (req, res, next) => { const rtratings = await rtapi.getTVRatings( tv.name, - Number(tv.first_air_date.slice(0, 4)) + tv.first_air_date ? Number(tv.first_air_date.slice(0, 4)) : undefined ); if (!rtratings) { diff --git a/src/components/TvDetails/index.tsx b/src/components/TvDetails/index.tsx index c75029ce4..7da4771c2 100644 --- a/src/components/TvDetails/index.tsx +++ b/src/components/TvDetails/index.tsx @@ -138,6 +138,14 @@ const TvDetails: React.FC = ({ tv }) => { } }; + const isComplete = + data.seasons.filter((season) => season.seasonNumber !== 0).length <= + ( + data.mediaInfo?.seasons.filter( + (season) => season.status === MediaStatus.AVAILABLE + ) ?? [] + ).length; + return (
= ({ tv }) => { )} - {data.mediaInfo && data.mediaInfo.status !== MediaStatus.UNKNOWN && ( - - - - } - text={ - <> + {data.mediaInfo && + data.mediaInfo.status !== MediaStatus.UNKNOWN && + !isComplete && ( + - - - } - onClick={() => setShowRequestModal(true)} - > - {hasPermission(Permission.MANAGE_REQUESTS) && - activeRequests && - activeRequests.length > 0 && ( + } + text={ <> - modifyRequests('approve')} + - + + + + } + onClick={() => setShowRequestModal(true)} + > + {hasPermission(Permission.MANAGE_REQUESTS) && + activeRequests && + activeRequests.length > 0 && ( + <> + modifyRequests('approve')} > - + + + - - - - modifyRequests('decline')} - > - + modifyRequests('decline')} > - + + + - - - - - )} - - )} + + + )} + + )} {hasPermission(Permission.MANAGE_REQUESTS) && (