feat(crm): merge company slogan variants in dedupe grouping

Treat names like "Affirm" and "Affirm — Fraud Engineering" as the same
company for dedupe, deal matching, members, and applications sync lookup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-24 12:40:27 +01:00
co-authored by Cursor
parent c77519fac5
commit 3eb649c58b
7 changed files with 109 additions and 9 deletions
+13 -2
View File
@@ -38,7 +38,7 @@ func GroupCompaniesByName(items []map[string]any) map[string][]map[string]any {
if !isCompany(row) {
continue
}
key := NormalizeCompanyName(rowDisplayName(row))
key := CompanyGroupingKey(rowDisplayName(row))
if key == "" {
continue
}
@@ -65,10 +65,21 @@ func GroupPersonsByKey(items []map[string]any) map[string][]map[string]any {
// DealTitleKey returns the grouping key for an opportunity title.
func DealTitleKey(title string, ignoreCompanySuffix bool) string {
title = strings.TrimSpace(title)
if ignoreCompanySuffix {
return NormalizeOpportunityTitle(StripCompanySuffix(title))
}
return NormalizeOpportunityTitle(title)
if i := strings.LastIndex(title, " @ "); i >= 0 {
pos := strings.TrimSpace(title[:i])
co := StripSloganSuffix(strings.TrimSpace(title[i+len(" @ "):]))
if pos == "" && co != "" {
return NormalizeCompanyName(co)
}
if pos != "" && co != "" {
return collapseKey(pos + " @ " + co)
}
}
return NormalizeCompanyName(StripSloganSuffix(title))
}
// GroupOpportunitiesByTitle buckets deals by title key.