From 7e96ba63dffa77e39b35c70ef063e6b7ba81a5dd Mon Sep 17 00:00:00 2001 From: daniel31x13 Date: Thu, 25 Jul 2024 14:21:39 -0400 Subject: [PATCH 1/2] minor improvement --- scripts/migration/pdfScreenshotIndexing.js | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/scripts/migration/pdfScreenshotIndexing.js b/scripts/migration/pdfScreenshotIndexing.js index a7659cf..c688a13 100644 --- a/scripts/migration/pdfScreenshotIndexing.js +++ b/scripts/migration/pdfScreenshotIndexing.js @@ -65,6 +65,8 @@ async function checkFileExistence(path) { } async function pdfScreenshotIndexing() { + let counter = 0; + const links = await prisma.link.findMany({ select: { id: true, @@ -88,10 +90,11 @@ async function pdfScreenshotIndexing() { where: { id: link.id }, data: { pdf: path }, }); - console.log(`${link.id}`); - } else { - console.log(`${link.id}`); } + + console.log(counter, "id:", link.id, "PDF"); + + counter++; } // Screenshots (PNGs) @@ -105,10 +108,11 @@ async function pdfScreenshotIndexing() { where: { id: link.id }, data: { image: path }, }); - console.log(`${link.id}`); - } else { - console.log(`${link.id}`); } + + console.log(counter, "id:", link.id, "PNG"); + + counter++; } // Screenshots (JPEGs) @@ -122,10 +126,11 @@ async function pdfScreenshotIndexing() { where: { id: link.id }, data: { image: path }, }); - console.log(`${link.id}`); - } else { - console.log(`${link.id}`); } + + console.log(counter, "id:", link.id, "JPEG"); + + counter++; } await prisma.$disconnect(); From 6983e41576c4623667e1753cc4b1ae52b74df0d8 Mon Sep 17 00:00:00 2001 From: daniel31x13 Date: Thu, 25 Jul 2024 14:23:33 -0400 Subject: [PATCH 2/2] minor improvement --- scripts/migration/pdfScreenshotIndexing.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/migration/pdfScreenshotIndexing.js b/scripts/migration/pdfScreenshotIndexing.js index c688a13..422085b 100644 --- a/scripts/migration/pdfScreenshotIndexing.js +++ b/scripts/migration/pdfScreenshotIndexing.js @@ -65,8 +65,6 @@ async function checkFileExistence(path) { } async function pdfScreenshotIndexing() { - let counter = 0; - const links = await prisma.link.findMany({ select: { id: true, @@ -79,6 +77,8 @@ async function pdfScreenshotIndexing() { orderBy: { id: "asc" }, }); + let counter = 0; + // PDFs for (let link of links) { const path = `archives/${link.collectionId}/${link.id}.pdf`; @@ -92,11 +92,13 @@ async function pdfScreenshotIndexing() { }); } - console.log(counter, "id:", link.id, "PDF"); + console.log("count:", counter, "id:", link.id, "PDF"); counter++; } + counter = 0; + // Screenshots (PNGs) for (let link of links) { const path = `archives/${link.collectionId}/${link.id}.png`; @@ -110,11 +112,13 @@ async function pdfScreenshotIndexing() { }); } - console.log(counter, "id:", link.id, "PNG"); + console.log("count:", counter, "id:", link.id, "PNG"); counter++; } + counter = 0; + // Screenshots (JPEGs) for (let link of links) { const path = `archives/${link.collectionId}/${link.id}.jpeg`; @@ -128,7 +132,7 @@ async function pdfScreenshotIndexing() { }); } - console.log(counter, "id:", link.id, "JPEG"); + console.log("count:", counter, "id:", link.id, "JPEG"); counter++; }