From a4c82a377b945198fc38b5e0013c05ed41817eb9 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sun, 4 Jun 2023 00:49:21 +0200 Subject: [PATCH] Returning existing release ID in case new scene for existing movie was encountered. --- src/tools/transfer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tools/transfer.js b/src/tools/transfer.js index d5b94971..84d318f4 100644 --- a/src/tools/transfer.js +++ b/src/tools/transfer.js @@ -509,6 +509,7 @@ async function linkMovieScenes(release, context) { async function addRelease(release, context) { const existingRelease = await knex(`${release.type}s`) + .select(`${release.type}s.*`, 'entities.name as entity_name') .leftJoin('entities', 'entities.id', `${release.type}s.entity_id`) .where('entry_id', release.entryId) .where('entities.slug', release.entity.slug) @@ -517,7 +518,12 @@ async function addRelease(release, context) { if (existingRelease) { console.log(`Skipping ${release.entity.slug} release "${release.title}", already in database`); - return false; + + return { + ...release, + id: existingRelease.id, + entityName: existingRelease.entity_name, + }; } const [entity] = await Promise.all([ @@ -552,7 +558,6 @@ async function addRelease(release, context) { const releaseWithId = { ...release, id: releaseEntry.id, - entityId: entity.id, entityName: entity.name, };