File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed
disable-import-audit-processor
opportunity-status-processor Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -39,13 +39,14 @@ export async function runDemoUrlProcessor(message, context) {
3939 organizationId,
4040 } ) ;
4141
42- await say ( env , log , slackContext , ':information_source: *Preparing demo url*' ) ;
4342 try {
4443 // prepare demo url
4544 const demoUrl = prepareDemoUrl ( siteUrl , organizationId , siteId ) ;
46- log . info ( `Setup complete! Access your demo environment here: ${ demoUrl } ` ) ;
47- const slackMessage = `:white_check_mark: Setup complete! Access your demo environment here: ${ demoUrl } ` ;
45+ let slackMessage = ':white_check_mark: Setup complete!' ;
46+ await say ( env , log , slackContext , slackMessage ) ;
47+ slackMessage = `:information_source: Access your demo environment here: ${ demoUrl } ` ;
4848 await say ( env , log , slackContext , slackMessage ) ;
49+ log . info ( `Setup complete! Access your demo environment here: ${ demoUrl } ` ) ;
4950 } catch ( error ) {
5051 log . error ( 'Error in preparing demo url:' , {
5152 error : error . message ,
Original file line number Diff line number Diff line change @@ -62,7 +62,9 @@ export async function runDisableImportAuditProcessor(message, context) {
6262 await configuration . save ( ) ;
6363 log . info ( 'Database changes saved successfully' ) ;
6464
65- const slackMessage = `:white_check_mark: Disabled imports ${ JSON . stringify ( importTypes ) } and audits ${ JSON . stringify ( auditTypes ) } for site ${ siteId } ` ;
65+ let slackMessage = `:white_check_mark: Disabled imports ${ JSON . stringify ( importTypes ) } for site ${ siteId } ` ;
66+ await say ( env , log , slackContext , slackMessage ) ;
67+ slackMessage = `:white_check_mark: Disabled audits ${ JSON . stringify ( auditTypes ) } for site ${ siteId } ` ;
6668 await say ( env , log , slackContext , slackMessage ) ;
6769 } catch ( error ) {
6870 log . error ( 'Error in disable import and audit processor:' , {
Original file line number Diff line number Diff line change @@ -73,10 +73,22 @@ export async function runOpportunityStatusProcessor(message, context) {
7373 const opportunities = await site . getOpportunities ( ) ;
7474 log . info ( `Found ${ opportunities . length } opportunities for site ${ siteId } ` ) ;
7575
76+ // Track processed opportunity types to avoid duplicates
77+ const processedTypes = new Set ( ) ;
78+
7679 // Process each opportunity
7780 for ( const opportunity of opportunities ) {
7881 const opportunityType = opportunity . getType ( ) ;
7982
83+ // Skip if we've already processed this opportunity type
84+ if ( processedTypes . has ( opportunityType ) ) {
85+ // eslint-disable-next-line no-continue
86+ continue ;
87+ }
88+
89+ // Mark this type as processed
90+ processedTypes . add ( opportunityType ) ;
91+
8092 // Get suggestions for this opportunity
8193 // eslint-disable-next-line no-await-in-loop
8294 const suggestions = await opportunity . getSuggestions ( ) ;
You can’t perform that action at this time.
0 commit comments