From 4aef5700962ee31503bb866f063fce4a16c068f3 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Tue, 4 Jun 2024 05:19:36 +0200 Subject: [PATCH] Filtering dateless scenes when showcasing is enabled. --- src/scenes.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scenes.js b/src/scenes.js index e2efe12..3889aa6 100644 --- a/src/scenes.js +++ b/src/scenes.js @@ -74,7 +74,7 @@ function curateScene(rawScene, assets) { slug: tag.slug, name: tag.name, })), - qualities: rawScene.qualities.sort((qualityA, qualityB) => qualityB - qualityA), + qualities: rawScene.qualities?.sort((qualityA, qualityB) => qualityB - qualityA) || [], movies: assets.movies.map((movie) => ({ id: movie.id, slug: movie.slug, @@ -360,6 +360,10 @@ async function queryManticoreSql(filters, options, _reqUser) { builder.where('scenes.is_showcased', filters.isShowcased); } + if (filters.isShowcased) { + builder.where('scenes.date', '>', 0); + } + if (!filters.scope || filters.scope === 'latest') { builder .where('effective_date', '<=', Math.round(Date.now() / 1000))