From ea268a4149793aa1cf25d393a3746bce38503d63 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Thu, 17 Oct 2024 09:28:18 +0530 Subject: [PATCH] Create deployments only if winning deployers are present --- packages/backend/src/service.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index a1b2a90d..44f0d762 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -319,21 +319,26 @@ export class Service { if (completedAuctionIds) { const projectsToBedeployed = projects.filter((project) => - completedAuctionIds.includes(project.auctionId!) && project.deployerLrns !== null + completedAuctionIds.includes(project.auctionId!) ); for (const project of projectsToBedeployed) { log(`Auction ${project!.auctionId} completed`); const deployerLrns = await this.laconicRegistry.getAuctionWinningDeployers(project!.auctionId!); - // Update project with deployer LRNs - await this.db.updateProjectById(project.id!, { - deployerLrns - }); - for (const deployer of deployerLrns) { - log(`Creating deployment for deployer LRN ${deployer}`); - await this.createDeploymentFromAuction(project, deployer); + if (!deployerLrns) { + log(`No winning deployer for auction ${project!.auctionId}`); + } else { + // Update project with deployer LRNs + await this.db.updateProjectById(project.id!, { + deployerLrns + }); + + for (const deployer of deployerLrns) { + log(`Creating deployment for deployer LRN ${deployer}`); + await this.createDeploymentFromAuction(project, deployer); + } } } }