Skip to content

Commit

Permalink
Merge pull request #3787 from uselagoon/polysite-disabled-projects
Browse files Browse the repository at this point in the history
refactor: exclude any disabled projects from polysite count
  • Loading branch information
tobybellwood authored Aug 6, 2024
2 parents 24acd1a + 72eb4d7 commit 571456b
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 571456b

Please sign in to comment.