From 721f5b91d806de9d451df6bcf6b73a8be7c88427 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sun, 3 Nov 2024 03:28:08 +0100 Subject: [PATCH] Fixed entity ID inherited from profile. --- actors.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actors.mjs b/actors.mjs index a6fe2f1..cab46fd 100644 --- a/actors.mjs +++ b/actors.mjs @@ -80,6 +80,7 @@ function mergeMainProfile(profile, mainProfile) { export async function interpolateProfiles(actorIdsOrNames, context, options = {}) { const profiles = await fetchProfiles(actorIdsOrNames, context); const columns = await context.knex.table('actors').columnInfo().then((table) => Object.keys(table)); + const preservedKeys = ['id', 'name', 'slug', 'entity_id', 'entry_id']; const profilesByActorId = profiles.reduce((acc, profile) => ({ ...acc, @@ -176,7 +177,7 @@ export async function interpolateProfiles(actorIdsOrNames, context, options = {} columns.forEach((key) => { // generic handling for remaining properties - if (Object.hasOwn(valuesByProperty, key) && !Object.hasOwn(profile, key)) { + if (Object.hasOwn(valuesByProperty, key) && !Object.hasOwn(profile, key) && !preservedKeys.includes(key)) { profile[key] = getMostFrequent(valuesByProperty[key], context); } }); @@ -187,7 +188,6 @@ export async function interpolateProfiles(actorIdsOrNames, context, options = {} const transaction = await context.knex.transaction(); // clear existing interpolated data - const preservedKeys = ['id', 'name', 'slug', 'entity_id', 'entry_id']; const emptyProfile = Object.fromEntries(columns.filter((key) => !preservedKeys.includes(key)).map((key) => [key, null])); await context.knex('actors')