From 59c836c45d89f9d5342b248f47f3deef73369405 Mon Sep 17 00:00:00 2001 From: Bryann Yeap Kok Keong Date: Mon, 7 Nov 2022 11:31:58 +0800 Subject: [PATCH] [offers][chore] Add logging for seed analysis --- apps/portal/prisma/seed-analysis.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/portal/prisma/seed-analysis.ts b/apps/portal/prisma/seed-analysis.ts index 929443dc..74d96822 100644 --- a/apps/portal/prisma/seed-analysis.ts +++ b/apps/portal/prisma/seed-analysis.ts @@ -14,13 +14,26 @@ const seedAnalysis = async () => { }, }); - for (const profile of profilesWithoutAnalysis) { + console.log( + 'Number of profiles found without analysis:', + profilesWithoutAnalysis.length, + ); + + let i = 0; + + while (i < profilesWithoutAnalysis.length) { + const profile = profilesWithoutAnalysis[i]; await generateAnalysis({ ctx: { prisma, session: null }, input: { profileId: profile.id }, }); - console.log('Analysis generated for profile with id:', profile.id); + + i++; + + console.log(i, ': Analysis generated for profile with id', profile.id); } + + console.log(i, ' analysis generated'); }; Promise.all([seedAnalysis()])