Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,21 @@ export async function getOrganizationMergeSuggestions(
continue
}

// Calculate similarity score between organizations
const secondaryOrg = opensearchToFullOrg(organizationToMerge._source)

const similarityConfidenceScore = OrganizationSimilarityCalculator.calculateSimilarity(
fullOrg,
opensearchToFullOrg(organizationToMerge._source),
secondaryOrg,
)

// Sort organizations: primary has more identities/activity, secondary is the one to merge
const organizationsSorted = [fullOrg, opensearchToFullOrg(organizationToMerge._source)].sort(
(a, b) => {
let organizationsSorted: IOrganizationFullAggregatesOpensearch[]
if (secondaryOrgWithLfxMembership && !primaryOrgWithLfxMembership) {
organizationsSorted = [secondaryOrg, fullOrg]
} else if (primaryOrgWithLfxMembership && !secondaryOrgWithLfxMembership) {
organizationsSorted = [fullOrg, secondaryOrg]
} else {
// Sort organizations: primary has more identities/activity, secondary is the one to merge
organizationsSorted = [fullOrg, secondaryOrg].sort((a, b) => {
if (
a.identities.length > b.identities.length ||
Comment thread
skwowet marked this conversation as resolved.
(a.identities.length === b.identities.length && a.activityCount > b.activityCount)
Expand All @@ -368,8 +374,8 @@ export async function getOrganizationMergeSuggestions(
return 1
}
return 0
},
)
})
}
Comment thread
skwowet marked this conversation as resolved.

mergeSuggestions.push({
similarity: similarityConfidenceScore,
Expand Down
Loading