Selecting deduped results on scene and movie updates pages.

This commit is contained in:
DebaucheryLibrarian 2024-11-05 04:07:42 +01:00
parent 3505282aa3
commit 442a564fa1
4 changed files with 24 additions and 12 deletions

View File

@ -8,6 +8,7 @@ export async function onBeforeRender(pageContext) {
}), { }), {
page: Number(pageContext.routeParams.page) || 1, page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 50, limit: Number(pageContext.urlParsed.search.limit) || 50,
dedupe: true,
}, pageContext.user); }, pageContext.user);
return { return {

View File

@ -18,6 +18,7 @@ export async function onBeforeRender(pageContext) {
page: Number(pageContext.routeParams.page) || 1, page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 29, limit: Number(pageContext.urlParsed.search.limit) || 29,
aggregate: withQuery, aggregate: withQuery,
dedupe: true,
}, pageContext.user), }, pageContext.user),
getRandomCampaigns([ getRandomCampaigns([
{ minRatio: 1.5 }, { minRatio: 1.5 },

View File

@ -204,11 +204,12 @@ function curateOptions(options) {
return { return {
limit: options?.limit || 30, limit: options?.limit || 30,
page: Number(options?.page) || 1, page: Number(options?.page) || 1,
aggregate: options.aggregate ?? true, aggregate: options?.aggregate ?? true,
aggregateYears: (options.aggregate ?? true) && (options.aggregateYears ?? true), aggregateYears: (options?.aggregate ?? true) && (options?.aggregateYears ?? true),
aggregateActors: (options.aggregate ?? true) && (options.aggregateActors ?? true), aggregateActors: (options?.aggregate ?? true) && (options?.aggregateActors ?? true),
aggregateTags: (options.aggregate ?? true) && (options.aggregateTags ?? true), aggregateTags: (options?.aggregate ?? true) && (options?.aggregateTags ?? true),
aggregateChannels: (options.aggregate ?? true) && (options.aggregateChannels ?? true), aggregateChannels: (options?.aggregate ?? true) && (options?.aggregateChannels ?? true),
dedupe: !!options?.dedupe,
}; };
} }
@ -290,6 +291,10 @@ async function queryManticoreSql(filters, options) {
builder.where('is_showcased', filters.isShowcased); builder.where('is_showcased', filters.isShowcased);
} }
if (options.dedupe) {
builder.where('movies.dupe_index', '<', 2);
}
if (!filters.scope || filters.scope === 'latest') { if (!filters.scope || filters.scope === 'latest') {
builder builder
.where('effective_date', '<=', Math.round(Date.now() / 1000)) .where('effective_date', '<=', Math.round(Date.now() / 1000))

View File

@ -358,13 +358,14 @@ function curateOptions(options) {
return { return {
limit: options?.limit || 30, limit: options?.limit || 30,
page: Number(options?.page) || 1, page: Number(options?.page) || 1,
aggregate: options.aggregate ?? true, aggregate: options?.aggregate ?? true,
aggregateYears: (options.aggregate ?? true) && (options.aggregateYears ?? true), aggregateYears: (options?.aggregate ?? true) && (options?.aggregateYears ?? true),
aggregateActors: (options.aggregate ?? true) && (options.aggregateActors ?? true), aggregateActors: (options?.aggregate ?? true) && (options?.aggregateActors ?? true),
aggregateTags: (options.aggregate ?? true) && (options.aggregateTags ?? true), aggregateTags: (options?.aggregate ?? true) && (options?.aggregateTags ?? true),
aggregateChannels: (options.aggregate ?? true) && (options.aggregateChannels ?? true), aggregateChannels: (options?.aggregate ?? true) && (options?.aggregateChannels ?? true),
index: options.index || 'scenes', dedupe: !!options?.dedupe,
useSql: options.useSql || (typeof options.useSql === 'undefined' && sqlImplied.includes(options.index)) || false, index: options?.index || 'scenes',
useSql: options?.useSql || (typeof options?.useSql === 'undefined' && sqlImplied.includes(options?.index)) || false,
}; };
} }
@ -480,6 +481,10 @@ async function queryManticoreSql(filters, options, _reqUser) {
builder.where('scenes.date', '>', 0); builder.where('scenes.date', '>', 0);
} }
if (options.dedupe) {
builder.where('scenes.dupe_index', '<', 2);
}
if (!filters.scope || filters.scope === 'latest') { if (!filters.scope || filters.scope === 'latest') {
builder builder
.where('effective_date', '<=', Math.round(Date.now() / 1000)) .where('effective_date', '<=', Math.round(Date.now() / 1000))