Updating Manticore scenes after tag reassociation.
This commit is contained in:
@@ -4,6 +4,7 @@ const logger = require('./logger')(__filename);
|
||||
const knex = require('./knex');
|
||||
|
||||
const { fetchEntityReleaseIds } = require('./entities');
|
||||
const { updateSceneSearch } = require('./update-search');
|
||||
|
||||
const slugify = require('./utils/slugify');
|
||||
const batchInsert = require('./utils/batch-insert');
|
||||
@@ -199,6 +200,8 @@ async function reassociateTagEntries(tagEntries, rematch) {
|
||||
tag_id: matchedTags[slugify(tagEntry.original_tag)],
|
||||
})).filter((tagEntry) => tagEntry.tag_id);
|
||||
|
||||
const sceneIds = Array.from(new Set(updatedTagEntries.map((tagEntry) => tagEntry.release_id))).filter(Boolean);
|
||||
|
||||
if (updatedTagEntries.length > 0) {
|
||||
const trx = await knex.transaction();
|
||||
|
||||
@@ -212,10 +215,13 @@ async function reassociateTagEntries(tagEntries, rematch) {
|
||||
})), {
|
||||
conflict: false,
|
||||
transaction: trx,
|
||||
commit: true,
|
||||
});
|
||||
|
||||
await updateSceneSearch(sceneIds);
|
||||
}
|
||||
|
||||
logger.info(`Updated ${updatedTagEntries.length} tags in ${new Set(updatedTagEntries.map((tagEntry) => tagEntry.release_id)).size} scenes`);
|
||||
logger.info(`Updated ${updatedTagEntries.length} tags in ${sceneIds.length} scenes`);
|
||||
}
|
||||
|
||||
async function reassociateReleaseTags(rawSceneIds, rematch) {
|
||||
|
||||
Reference in New Issue
Block a user