Skip to content

Commit 5901910

Browse files
adjust condition
1 parent 68ab01a commit 5901910

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • src/tasks/cwv-demo-suggestions-processor

src/tasks/cwv-demo-suggestions-processor/handler.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ async function updateSuggestionWithGenericIssues(
108108
logger.info(`Loading CWV reference suggestions from: ${filename}, ${dirname}, ${jsonPath}`);
109109
const rawData = fs.readFileSync(jsonPath, 'utf-8');
110110
cwvReferenceSuggestions = JSON.parse(rawData);
111+
await say(env, logger, slackContext, `Loaded CWV reference suggestions from: ${jsonPath}`);
111112
} catch (error) {
112113
logger.error(`Error loading CWV reference suggestions: ${error.message}`);
113114
await say(env, logger, slackContext, `Failed to load CWV reference suggestions: ${error.message}`);
@@ -215,12 +216,12 @@ async function processCWVOpportunity(opportunity, logger, env, slackContext) {
215216
const issuesAddedResults = await Promise.all(updatePromises);
216217
const totalIssuesAdded = issuesAddedResults.reduce((sum, issuesAdded) => sum + issuesAdded, 0);
217218

218-
if (suggestionsToUpdate.length > 0) {
219-
logger.info(`Added ${totalIssuesAdded} generic CWV suggestions for opportunity ${opportunity.getId()}`);
219+
if (totalIssuesAdded > 0) {
220220
await say(env, logger, slackContext, `🎯 Added ${totalIssuesAdded} generic CWV suggestions for opportunity ${opportunity.getId()}`);
221+
logger.info(`Added ${totalIssuesAdded} generic CWV suggestions for opportunity ${opportunity.getId()}`);
221222
} else {
223+
await say(env, logger, slackContext, `:x: No generic CWV suggestions added for opportunity ${opportunity.getId()}`);
222224
logger.info(`No generic CWV suggestions added for opportunity ${opportunity.getId()}`);
223-
await say(env, logger, slackContext, `No generic CWV suggestions added for opportunity ${opportunity.getId()}`);
224225
}
225226

226227
return suggestionsToUpdate.length;

0 commit comments

Comments
 (0)