Change how video duration check works for submissions

This commit is contained in:
Ajay 2024-05-27 13:54:02 -04:00
parent 8eb6f5b2ea
commit 5c10e071dc

View file

@ -388,9 +388,12 @@ async function updateDataIfVideoDurationChange(videoID: VideoID, service: Servic
// Only treat as difference if both the api duration and submitted duration have changed
if (videoDurationChanged(videoDuration) && (!videoDurationParam || videoDurationChanged(videoDurationParam))) {
// Hide all previous submissions
for (const submission of previousSubmissions) {
await db.prepare("run", `UPDATE "sponsorTimes" SET "hidden" = 1 WHERE "UUID" = ?`, [submission.UUID]);
}
await db.prepare("run", `UPDATE "sponsorTimes" SET "hidden" = 1
WHERE "videoID" = ? AND "service" = ? AND "videoDuration" != ?
AND "hidden" = 0 AND "shadowHidden" = 0 AND
"actionType" != 'full' AND "votes" > -2`,
[videoID, service, videoDuration]);
lockedCategoryList = [];
deleteLockCategories(videoID, null, null, service).catch((e) => Logger.error(`deleting lock categories: ${e}`));
}