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 committed Nov 21, 2024
1 parent c4df5a6 commit 9c16d16
Showing 1 changed file with 3 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 @@ -40,14 +40,14 @@ export async function formsAuditRunner(auditUrl, context, site) {
const auditResult = {
formVitals: formsAuditLinks['form-vitals'].filter((data) => {
// Calculate the sum of all values inside the `pageview` object
// eslint-disable-next-line max-len
const pageviewsSum = Object.values(data.pageview).reduce((sum, value) => sum + value, 0);
return pageviewsSum >= DAILY_THRESHOLD * INTERVAL;
})
.map((formVital) => {
const cwvData = cwvMap.get(formVital.url);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { url, pageviews, ...filteredCwvData } = cwvData || {};
const filteredCwvData = cwvData
? Object.fromEntries(Object.entries(cwvData).filter(([key]) => key !== 'url' && key !== 'pageviews'))
: {};
return {
...formVital,
cwv: filteredCwvData, // Append cwv data
Expand Down

0 comments on commit 9c16d16

Please sign in to comment.