diff --git a/.all-contributorsrc b/.all-contributorsrc index 5ece548e..37187275 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -863,6 +863,15 @@ "contributions": [ "code" ] + }, + { + "login": "Fallenbagel", + "name": "Fallenbagel", + "avatar_url": "https://avatars.githubusercontent.com/u/98979876?v=4", + "profile": "https://github.com/Fallenbagel", + "contributions": [ + "code" + ] } ], "badgeTemplate": "\"All-orange.svg\"/>", diff --git a/server/api/rottentomatoes.ts b/server/api/rottentomatoes.ts index 7695e398..99a74eb1 100644 --- a/server/api/rottentomatoes.ts +++ b/server/api/rottentomatoes.ts @@ -17,7 +17,7 @@ interface RTAlgoliaHit { title: string; titles: string[]; description: string; - releaseYear: string; + releaseYear: number; rating: string; genres: string[]; updateDate: string; @@ -111,22 +111,19 @@ class RottenTomatoes extends ExternalAPI { // First, attempt to match exact name and year let movie = contentResults.hits.find( - (movie) => movie.releaseYear === year.toString() && movie.title === name + (movie) => movie.releaseYear === year && movie.title === name ); // If we don't find a movie, try to match partial name and year if (!movie) { movie = contentResults.hits.find( - (movie) => - movie.releaseYear === year.toString() && movie.title.includes(name) + (movie) => movie.releaseYear === year && movie.title.includes(name) ); } // If we still dont find a movie, try to match just on year if (!movie) { - movie = contentResults.hits.find( - (movie) => movie.releaseYear === year.toString() - ); + movie = contentResults.hits.find((movie) => movie.releaseYear === year); } // One last try, try exact name match only @@ -181,7 +178,7 @@ class RottenTomatoes extends ExternalAPI { if (year) { tvshow = contentResults.hits.find( - (series) => series.releaseYear === year.toString() + (series) => series.releaseYear === year ); }