Merge pull request #673 from ashudevcodes/dev

fix: movies with unavailable posters will be shown in the last row
This commit is contained in:
mrjvs 2024-01-02 19:54:16 +01:00 committed by GitHub
commit 245f4a540f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,12 @@ export async function searchForMedia(query: MWQuery): Promise<MediaItem[]> {
return formatTMDBMetaToMediaItem(formattedResult);
});
cache.set(query, results, 3600); // cache results for 1 hour
return results;
const movieWithPosters = results.filter((movie) => movie.poster);
const movieWithoutPosters = results.filter((movie) => !movie.poster);
const sortedresult = movieWithPosters.concat(movieWithoutPosters);
// cache results for 1 hour
cache.set(query, sortedresult, 3600);
return sortedresult;
}