Skip to content

Commit

Permalink
refactor: exclude any disabled projects from polysite count
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Aug 5, 2024
1 parent d31f3ce commit 72eb4d7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion services/webhooks2tasks/src/webhooks/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 72eb4d7

Please sign in to comment.