wm-AllKids-tibi2023/api/hooks/lighthouse/post_create.js
robin ab3f5cfbbf
Some checks failed
deploy to production / lighthouse-evaluation (push) Failing after 0s
deploy to production / deploy (push) Failing after 0s
fixes
2024-07-11 18:20:59 +00:00

17 lines
579 B
JavaScript

var { setUpQuery, calculateAverageDynamically, run } = require("../lib/utils")
;(function () {
let subPaths = context.db.find("lighthouseSubpath")
let urls = []
for (let i = 0; i < subPaths.length; i++) {
urls.push(setUpQuery(subPaths[i].lighthouseSubpath))
}
let dbObjs = []
urls.forEach((url) => {
console.log("URL:", url)
dbObjs.push(run(url))
})
let dbObject = calculateAverageDynamically(dbObjs)
dbObject.analyzedPaths = [...subPaths].map((subPath) => subPath.lighthouseSubpath)
return { data: dbObject }
})()