Skip to content

Commit cc9d2ee

Browse files
combine messages
1 parent 087da0c commit cc9d2ee

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/tasks/opportunity-status-processor/handler.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export async function runOpportunityStatusProcessor(message, context) {
7474

7575
// Track processed opportunity types to avoid duplicates
7676
const processedTypes = new Set();
77+
const statusMessages = [];
7778

7879
// Process each opportunity
7980
for (const opportunity of opportunities) {
@@ -99,10 +100,14 @@ export async function runOpportunityStatusProcessor(message, context) {
99100
const hasSuggestions = suggestions && suggestions.length > 0;
100101
const status = hasSuggestions ? ':white_check_mark:' : ':cross-x:';
101102

102-
// Send Slack message
103-
const slackMessage = `${opportunityTitle} ${status}`;
104-
// eslint-disable-next-line no-await-in-loop
105-
await say(env, log, slackContext, slackMessage);
103+
// Add to status messages array
104+
statusMessages.push(`${opportunityTitle} ${status}`);
105+
}
106+
107+
// Send combined status message
108+
if (statusMessages.length > 0) {
109+
const combinedMessage = statusMessages.join(', ');
110+
await say(env, log, slackContext, combinedMessage);
106111
}
107112

108113
log.info('Opportunity status checking completed');

0 commit comments

Comments
 (0)