diff --git a/services/apps/snowflake_connectors/src/core/personalEmail.ts b/services/apps/snowflake_connectors/src/core/personalEmail.ts index d7d1c97798..e9439d9423 100644 --- a/services/apps/snowflake_connectors/src/core/personalEmail.ts +++ b/services/apps/snowflake_connectors/src/core/personalEmail.ts @@ -1,6 +1,6 @@ import { cleanIdentityValue } from './transformerBase' -const SHARED_MEETING_ACCOUNT_EMAILS = new Set([ +export const SHARED_MEETING_ACCOUNT_EMAILS = new Set([ 'meeting1@seidengroup.com', 'meetings@dpdk.org', 'zoom-admin@nephio.org', diff --git a/services/apps/snowflake_connectors/src/integrations/meetings/meeting-attendance/buildSourceQuery.test.ts b/services/apps/snowflake_connectors/src/integrations/meetings/meeting-attendance/buildSourceQuery.test.ts index 96cfb54a4b..584b605752 100644 --- a/services/apps/snowflake_connectors/src/integrations/meetings/meeting-attendance/buildSourceQuery.test.ts +++ b/services/apps/snowflake_connectors/src/integrations/meetings/meeting-attendance/buildSourceQuery.test.ts @@ -17,6 +17,12 @@ describe('buildSourceQuery', () => { }, ) + it('keeps shared meeting host accounts out of the export', () => { + expect(buildSourceQuery()).toContain( + "AND LOWER(TRIM(t.INVITEE_EMAIL)) NOT IN ('meeting1@seidengroup.com', 'meetings@dpdk.org', 'zoom-admin@nephio.org', 'zoom0@hyperledger.org', 'zoom2@hyperledger.org', 'zoom2@lfai.foundation', 'zoom@hyperledger.org', 'zoom@longnowboston.org', 'zoom@openwallet.foundation')", + ) + }) + it('lets the LF SSO lookup fill in when the row itself carries a placeholder SSO', () => { expect(buildSourceQuery()).toContain( "CASE WHEN UPPER(TRIM(t.INVITEE_LF_SSO)) NOT IN ('', 'NONE', 'NULL', 'UNDEFINED', 'NA', 'N/A', '-') THEN t.INVITEE_LF_SSO END,\n sso.LF_SSO", diff --git a/services/apps/snowflake_connectors/src/integrations/meetings/meeting-attendance/buildSourceQuery.ts b/services/apps/snowflake_connectors/src/integrations/meetings/meeting-attendance/buildSourceQuery.ts index 2e9f5b4e94..eec349cdb3 100644 --- a/services/apps/snowflake_connectors/src/integrations/meetings/meeting-attendance/buildSourceQuery.ts +++ b/services/apps/snowflake_connectors/src/integrations/meetings/meeting-attendance/buildSourceQuery.ts @@ -1,5 +1,7 @@ import { IS_PROD_ENV } from '@crowd/common' +import { SHARED_MEETING_ACCOUNT_EMAILS } from '../../../core/personalEmail' + const CDP_MATCHED_SEGMENTS = ` cdp_matched_segments AS ( SELECT DISTINCT @@ -24,6 +26,8 @@ const ORG_ACCOUNTS = ` const PLACEHOLDER_VALUES = `('', 'NONE', 'NULL', 'UNDEFINED', 'NA', 'N/A', '-')` +const SHARED_MEETING_ACCOUNT_EMAIL_VALUES = `(${[...SHARED_MEETING_ACCOUNT_EMAILS].map((email) => `'${email}'`).join(', ')})` + const LF_SSO_LOOKUP = ` lf_sso_lookup AS ( SELECT INVITEE_LF_USER_ID AS LF_USER_ID, MAX(INVITEE_LF_SSO) AS LF_SSO @@ -73,7 +77,8 @@ export const buildSourceQuery = (sinceTimestamp?: string): string => { LEFT JOIN org_accounts org ON t.ACCOUNT_ID = org.account_id WHERE (t.WAS_INVITED = TRUE OR t.INVITEE_ATTENDED = TRUE) - AND NULLIF(TRIM(t.INVITEE_EMAIL), '') IS NOT NULL` + AND NULLIF(TRIM(t.INVITEE_EMAIL), '') IS NOT NULL + AND LOWER(TRIM(t.INVITEE_EMAIL)) NOT IN ${SHARED_MEETING_ACCOUNT_EMAIL_VALUES}` if (!IS_PROD_ENV) { select += ` AND t.PROJECT_SLUG = 'cncf'`