From 5576fed59079266c875918270ca86bcce65b8c11 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Thu, 8 Jun 2023 01:37:27 +0200 Subject: [PATCH] Fixed existing stash selection in transfer tool. --- src/tools/stashes-load.js | 9 ++++++--- src/tools/stashes-save.js | 6 ++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/tools/stashes-load.js b/src/tools/stashes-load.js index db8ce48c..8cccfd37 100644 --- a/src/tools/stashes-load.js +++ b/src/tools/stashes-load.js @@ -7,9 +7,12 @@ async function getStashId(stash, user) { .select('id') .where('user_id', user.id) .where((builder) => { - builder - .where('slug', stash.slug) - .orWhere('primary', stash.primary); + if (stash.primary) { + builder.where('primary', true); + return; + } + + builder.where('slug', stash.slug); }) .first(); diff --git a/src/tools/stashes-save.js b/src/tools/stashes-save.js index c10921e3..967d072b 100644 --- a/src/tools/stashes-save.js +++ b/src/tools/stashes-save.js @@ -38,10 +38,6 @@ async function save() { .leftJoin('entities', 'entities.id', 'actors.entity_id') .where('stashes_actors.stash_id', stash.id); - console.log('scenes', scenes); - console.log('movies', movies); - console.log('actors', actors); - const curatedStash = JSON.stringify({ username: stash.username, name: stash.name, @@ -73,6 +69,8 @@ async function save() { await fs.promises.appendFile(filename, `${curatedStash}\n`); + console.log(`Saved ${stash.username} stash ${stash.name}`); + savedStashes += 1; }, Promise.resolve([]));