@@ -70,7 +70,7 @@ async function addUsers() {
7070 // Create a queue with limited concurrency for user operations
7171 const userQueue = new PQueue ( { concurrency : 2 } ) ;
7272
73- const userPromises = users . map ( ( user ) =>
73+ users . map ( ( user ) =>
7474 userQueue . add ( async ( ) => {
7575 try {
7676 const password = 'Ch0kuda1' ;
@@ -90,7 +90,7 @@ async function addUsers() {
9090 } ) ,
9191 ) ;
9292
93- await Promise . all ( userPromises ) ;
93+ await userQueue . onIdle ( ) ; // Wait for all users to complete
9494 console . log ( 'Finished adding users.' ) ;
9595}
9696
@@ -119,7 +119,7 @@ async function addTasks() {
119119 // Create a queue with limited concurrency for database operations
120120 const taskQueue = new PQueue ( { concurrency : 3 } ) ;
121121
122- const taskPromises = tasks . map ( ( task ) =>
122+ tasks . map ( ( task ) =>
123123 taskQueue . add ( async ( ) => {
124124 try {
125125 const registeredTask = await prisma . task . findUnique ( {
@@ -143,7 +143,7 @@ async function addTasks() {
143143 } ) ,
144144 ) ;
145145
146- await Promise . all ( taskPromises ) ;
146+ await taskQueue . onIdle ( ) ; // Wait for all tasks to complete
147147 console . log ( 'Finished adding tasks.' ) ;
148148}
149149
@@ -276,7 +276,7 @@ async function addWorkBook(workbook, workBookFactory) {
276276 * ```
277277 */
278278function normalizeUrlSlug ( urlSlug : string | null | undefined ) : string | undefined {
279- return urlSlug && urlSlug !== '' ? urlSlug : undefined ;
279+ return urlSlug && urlSlug !== '' ? urlSlug . toLocaleLowerCase ( ) : undefined ;
280280}
281281
282282async function addTags ( ) {
@@ -287,7 +287,7 @@ async function addTags() {
287287 // Create a queue with limited concurrency for tag operations
288288 const tagQueue = new PQueue ( { concurrency : 2 } ) ;
289289
290- const tagPromises = tags . map ( ( tag ) =>
290+ tags . map ( ( tag ) =>
291291 tagQueue . add ( async ( ) => {
292292 try {
293293 const registeredTag = await prisma . tag . findMany ( {
@@ -311,7 +311,7 @@ async function addTags() {
311311 } ) ,
312312 ) ;
313313
314- await Promise . all ( tagPromises ) ;
314+ await tagQueue . onIdle ( ) ; // Wait for all tags to complete
315315 console . log ( 'Finished adding tags.' ) ;
316316}
317317
@@ -354,7 +354,7 @@ async function addTaskTags() {
354354 // Create a queue with limited concurrency for task tag operations
355355 const taskTagQueue = new PQueue ( { concurrency : 2 } ) ;
356356
357- const taskTagPromises = task_tags . map ( ( task_tag ) =>
357+ task_tags . map ( ( task_tag ) =>
358358 taskTagQueue . add ( async ( ) => {
359359 try {
360360 const registeredTaskTag = await prisma . taskTag . findMany ( {
@@ -387,7 +387,7 @@ async function addTaskTags() {
387387 } ) ,
388388 ) ;
389389
390- await Promise . all ( taskTagPromises ) ;
390+ await taskTagQueue . onIdle ( ) ; // Wait for all task tags to complete
391391 console . log ( 'Finished adding task tags.' ) ;
392392}
393393async function addTaskTag ( task_tag , taskTagFactory ) {
@@ -412,7 +412,7 @@ async function addSubmissionStatuses() {
412412 // Create a queue with limited concurrency for submission status operations
413413 const submissionStatusQueue = new PQueue ( { concurrency : 2 } ) ;
414414
415- const submissionStatusPromises = submission_statuses . map ( ( submission_status ) =>
415+ submission_statuses . map ( ( submission_status ) =>
416416 submissionStatusQueue . add ( async ( ) => {
417417 try {
418418 const registeredSubmissionStatus = await prisma . submissionStatus . findMany ( {
@@ -431,7 +431,7 @@ async function addSubmissionStatuses() {
431431 } ) ,
432432 ) ;
433433
434- await Promise . all ( submissionStatusPromises ) ;
434+ await submissionStatusQueue . onIdle ( ) ; // Wait for all submission statuses to complete
435435 console . log ( 'Finished adding submission statuses.' ) ;
436436}
437437
@@ -455,7 +455,7 @@ async function addAnswers() {
455455 // Create a queue with limited concurrency for answer operations
456456 const answerQueue = new PQueue ( { concurrency : 2 } ) ;
457457
458- const answerPromises = answers . map ( ( answer ) =>
458+ answers . map ( ( answer ) =>
459459 answerQueue . add ( async ( ) => {
460460 try {
461461 const registeredAnswer = await prisma . taskAnswer . findMany ( {
@@ -489,7 +489,7 @@ async function addAnswers() {
489489 } ) ,
490490 ) ;
491491
492- await Promise . all ( answerPromises ) ;
492+ await answerQueue . onIdle ( ) ; // Wait for all answers to complete
493493 console . log ( 'Finished adding answers.' ) ;
494494}
495495
0 commit comments