Added permanent filter for invalid actor associations.

This commit is contained in:
DebaucheryLibrarian 2021-03-04 00:31:31 +01:00
parent ed7bffd2d6
commit 254e933740
1 changed files with 8 additions and 2 deletions

View File

@ -944,9 +944,15 @@ async function associateActors(releases, batchId) {
}))) })))
.flat(); .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`); logger.verbose(`Associated ${releaseActorAssociations.length} actors to ${releases.length} scenes`);