diff --git a/shared.go b/shared.go index 284265b..bff82e7 100755 --- a/shared.go +++ b/shared.go @@ -5790,7 +5790,7 @@ func UpdateAppAuth(ctx context.Context, auth AppAuthenticationStorage, workflowI } auth.Usage = append(auth.Usage, usageItem) - auth.WorkflowCount += 1 + // auth.WorkflowCount += 1 auth.NodeCount += 1 updateAuth = true } else if !nodeFound && add { @@ -5809,6 +5809,16 @@ func UpdateAppAuth(ctx context.Context, auth AppAuthenticationStorage, workflowI } } + // go through auth.Usage and compile unique list of workflow_ids + var workflowIds []string + for _, usage := range auth.Usage { + if !ArrayContains(workflowIds, usage.WorkflowId) { + workflowIds = append(workflowIds, usage.WorkflowId) + } + } + + auth.WorkflowCount = len(workflowIds) + return nil }