diff --git a/src/promotion.ts b/src/promotion.ts index 92b1e67..4bf0afe 100644 --- a/src/promotion.ts +++ b/src/promotion.ts @@ -353,7 +353,7 @@ export class Promotion { suppressed = excluded.suppressed, contacts_out = excluded.contacts_out, contacts_in = excluded.contacts_in, last_contact_at = excluded.last_contact_at, upstream = excluded.upstream, source_order = excluded.source_order, seen_import = excluded.seen_import`, [ - c.id, r.row.leadId, r.disposition === 'matched' || r.disposition === 'merged' ? r.domain : null, String(r.row.name ?? ''), String(r.row.title ?? ''), String(r.row.kind ?? ''), + c.id, r.row.leadId, r.domain, String(r.row.name ?? ''), String(r.row.title ?? ''), String(r.row.kind ?? ''), JSON.stringify((r.row.emails ?? []).map((e) => String(e).toLowerCase())), r.row.suppressed ? 1 : 0, r.row.contacts?.outbound ?? 0, r.row.contacts?.inbound ?? 0, r.row.contacts?.lastAt ?? null, JSON.stringify(r.row.campaigns ?? []), r.row.order ?? r.index + 1, importId, ], diff --git a/test/promotion.test.ts b/test/promotion.test.ts index 13a9b90..4b52da6 100644 --- a/test/promotion.test.ts +++ b/test/promotion.test.ts @@ -95,6 +95,9 @@ describe('promotion: import and reconciliation', () => { expect(rows.find((x) => x.lead_id === 'per_3')).toMatchObject({ disposition: 'matched', domain: 'bravo-homes.com' }) const alpha = h.promo.member(h.campaign, 'alpha-build.com') expect(alpha.leads.map((l) => l.leadId)).toEqual(['per_1', 'per_2']) + // An excluded business still shows the leads it came from in the roster. + const dead = h.promo.roster(h.campaign).businesses.find((b) => b.website === 'https://dead-site.com/')! + expect(dead).toMatchObject({ leadIds: ['per_7'], verification: 'excluded', plannedAction: 'none: excluded' }) }) it('re-importing the same snapshot changes nothing (AC-03)', () => {