Skip to content

Commit

Permalink
forms audit worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul Kumar Singh authored and Rahul Kumar Singh committed Nov 21, 2024
1 parent 9c16d16 commit bdc8ec2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/forms-opportunities/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export async function formsAuditRunner(auditUrl, context, site) {
granularity: 'hourly',
};

const formsAuditLinks = await rumAPIClient.queryMulti(FORMS_OPPTY_QUERIES, options);
const queryResults = await rumAPIClient.queryMulti(FORMS_OPPTY_QUERIES, options);
const cwvMap = new Map(
formsAuditLinks.cwv.map((cwv) => [cwv.url, cwv]),
queryResults.cwv.map((cwv) => [cwv.url, cwv]),
);

const auditResult = {
formVitals: formsAuditLinks['form-vitals'].filter((data) => {
formVitals: queryResults['form-vitals'].filter((data) => {
// Calculate the sum of all values inside the `pageview` object
const pageviewsSum = Object.values(data.pageview).reduce((sum, value) => sum + value, 0);
return pageviewsSum >= DAILY_THRESHOLD * INTERVAL;
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import conversion from './conversion/handler.js';
import essExperimentationDaily from './experimentation-ess/daily.js';
import essExperimentationAll from './experimentation-ess/all.js';
import experimentationOpportunities from './experimentation-opportunities/experimentation-opportunities.js';
import formsOpportunities from './forms-opportunities/handler.js';
import metaTags from './metatags/handler.js';
import costs from './costs/handler.js';
import structuredData from './structured-data/handler.js';
Expand All @@ -54,6 +55,7 @@ const HANDLERS = {
'meta-tags': metaTags,
costs,
'structured-data': structuredData,
'forms-opportunities': formsOpportunities,
dummy: (message) => ok(message),
};

Expand Down

0 comments on commit bdc8ec2

Please sign in to comment.