From 72eb4d79d8c2fb94e80ef0b55db373eac680505f Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Tue, 6 Aug 2024 08:48:00 +1000 Subject: [PATCH] refactor: exclude any disabled projects from polysite count --- services/webhooks2tasks/src/webhooks/projects.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/webhooks2tasks/src/webhooks/projects.ts b/services/webhooks2tasks/src/webhooks/projects.ts index 59ee82b8ad..9a2fc6ff10 100644 --- a/services/webhooks2tasks/src/webhooks/projects.ts +++ b/services/webhooks2tasks/src/webhooks/projects.ts @@ -141,8 +141,14 @@ export async function processProjects( return; } + // count if any projects are disabled in the result + let disabledProjects = projects.filter(function(element){ + return element.deploymentsDisabled == 1; + }).length + // if there are more than 1 projects returned, it is probably a polysite deployment - if (projects.length > 1) { + // also if the number of projects minus the number of any disabled projects is more than 1 + if (projects.length > 1 && (projects.length - disabledProjects > 1)) { // label them as a bulk or grouped deployment // assign a random uuid webhook.bulkId = crypto.randomUUID()