From 254e933740a1530fb76b800aee5f7d7a601475f0 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Thu, 4 Mar 2021 00:31:31 +0100 Subject: [PATCH] Added permanent filter for invalid actor associations. --- src/actors.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/actors.js b/src/actors.js index 93b8b467..649262cd 100644 --- a/src/actors.js +++ b/src/actors.js @@ -944,9 +944,15 @@ async function associateActors(releases, batchId) { }))) .flat(); - logger.debug(releaseActorAssociations); + const validReleaseActorAssociations = releaseActorAssociations.filter(association => association.release_id && association.actor_id); - await bulkInsert('releases_actors', releaseActorAssociations, false); + if (releaseActorAssociations.length > validReleaseActorAssociations.length) { + const invalidReleaseActorAssociations = releaseActorAssociations.filter(association => !association.release_id || !association.actor_id); + + logger.error(invalidReleaseActorAssociations); + } + + await bulkInsert('releases_actors', validReleaseActorAssociations, false); logger.verbose(`Associated ${releaseActorAssociations.length} actors to ${releases.length} scenes`);