From e329bccca5d6fc99ad9bf5481e0a5918ffbdd4c6 Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 27 Sep 2023 20:09:15 -0400 Subject: [PATCH] Remove shuffling for thumbnails --- src/routes/getBranding.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/routes/getBranding.ts b/src/routes/getBranding.ts index b832f3e..634c1e5 100644 --- a/src/routes/getBranding.ts +++ b/src/routes/getBranding.ts @@ -35,7 +35,8 @@ export async function getVideoBranding(res: Response, videoID: VideoID, service: "all", `SELECT "thumbnailTimestamps"."timestamp", "thumbnails"."original", "thumbnailVotes"."votes", "thumbnailVotes"."locked", "thumbnailVotes"."shadowHidden", "thumbnails"."UUID", "thumbnails"."videoID", "thumbnails"."hashedVideoID", "thumbnails"."userID" FROM "thumbnails" LEFT JOIN "thumbnailVotes" ON "thumbnails"."UUID" = "thumbnailVotes"."UUID" LEFT JOIN "thumbnailTimestamps" ON "thumbnails"."UUID" = "thumbnailTimestamps"."UUID" - WHERE "thumbnails"."videoID" = ? AND "thumbnails"."service" = ? AND "thumbnailVotes"."votes" > -2`, + WHERE "thumbnails"."videoID" = ? AND "thumbnails"."service" = ? AND "thumbnailVotes"."votes" > -2 + ORDER BY "thumbnails"."timeSubmitted" ASC`, [videoID, service], { useReplica: true } ) as Promise; @@ -99,7 +100,8 @@ export async function getVideoBrandingByHash(videoHashPrefix: VideoIDHash, servi "all", `SELECT "thumbnailTimestamps"."timestamp", "thumbnails"."original", "thumbnailVotes"."votes", "thumbnailVotes"."locked", "thumbnailVotes"."shadowHidden", "thumbnails"."UUID", "thumbnails"."videoID", "thumbnails"."hashedVideoID" FROM "thumbnails" LEFT JOIN "thumbnailVotes" ON "thumbnails"."UUID" = "thumbnailVotes"."UUID" LEFT JOIN "thumbnailTimestamps" ON "thumbnails"."UUID" = "thumbnailTimestamps"."UUID" - WHERE "thumbnails"."hashedVideoID" LIKE ? AND "thumbnails"."service" = ? AND "thumbnailVotes"."votes" > -2`, + WHERE "thumbnails"."hashedVideoID" LIKE ? AND "thumbnails"."service" = ? AND "thumbnailVotes"."votes" > -2 + ORDER BY "thumbnails"."timeSubmitted" ASC`, [`${videoHashPrefix}%`, service], { useReplica: true } ) as Promise; @@ -182,7 +184,7 @@ async function filterAndSortBranding(videoID: VideoID, returnUserID: boolean, db .sort((a, b) => b.votes - a.votes) .sort((a, b) => +b.locked - +a.locked) as TitleResult[]; - const thumbnails = shuffleArray(dbThumbnails.filter(await shouldKeepThumbnails)) + const thumbnails = dbThumbnails.filter(await shouldKeepThumbnails) .sort((a, b) => +a.original - +b.original) .sort((a, b) => b.votes - a.votes) .sort((a, b) => b.locked - a.locked)