From 4e8e7318e2e326f95f801d4db471fe8a733fe2cb Mon Sep 17 00:00:00 2001 From: zkldi Date: Thu, 29 Apr 2021 23:16:24 +0100 Subject: [PATCH] fixes related to process-pb tests --- .../score-import/framework/core/pb/process-pbs.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/src/score-import/framework/core/pb/process-pbs.ts b/server/src/score-import/framework/core/pb/process-pbs.ts index b0e3727cd..2b5923d05 100644 --- a/server/src/score-import/framework/core/pb/process-pbs.ts +++ b/server/src/score-import/framework/core/pb/process-pbs.ts @@ -12,6 +12,19 @@ export async function ProcessPBs(userID: integer, chartIDs: Set, logger: let pbDocs = (await Promise.all(promises)).filter((e) => !!e) as PBScoreDocument[]; + if (pbDocs.length === 0) { + let toStr = ""; + for (const c of chartIDs) { + toStr += `${c},`; + } + + logger.warn( + `Skipping PB processing as pbDocs is an empty array. This was probably caused by a previous severe-level warning.`, + { userID, chartIDs: toStr } + ); + return 0; + } + let r = await db["score-pbs"].bulkWrite( pbDocs.map((e) => ({ updateOne: {