diff --git a/package-lock.json b/package-lock.json index 65c78eb..7bf2f90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "crawler-handler", - "version": "2.2.18", + "version": "2.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "crawler-handler", - "version": "2.2.18", + "version": "2.3.1", "license": "BSD-3-Clause", "dependencies": { "@types/sequelize": "^4.28.13", diff --git a/package.json b/package.json index 7c4edff..0cc9599 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crawler-handler", - "version": "2.2.18", + "version": "2.3.1", "description": "Handler per il validatore di comuni e scuole", "main": "index.js", "type": "module", diff --git a/utils/utils.ts b/utils/utils.ts index 54e20e4..404b179 100644 --- a/utils/utils.ts +++ b/utils/utils.ts @@ -115,17 +115,32 @@ const mapPA2026Body = async ( console.log("MAP PA2026 BODY EXCEPTION 01: ", e); } + const siteUrl = new URL(job.scan_url); + + const crawlerVersion = + packageJSON?.dependencies["pa-website-validator"]?.split("#")[1] ?? ""; + const initialBody = []; initialBody[`Nome_file_${key}__c`] = `Report scansione ` + - job.id + + siteUrl.host + + "_" + + new Date() + .toLocaleDateString("en-US", { + year: "numeric", + month: "2-digit", + day: "2-digit", + }) + .replace(/\//g, "") + "_" + - new Date().toISOString().split("T")[0] + + crawlerVersion + + "_" + + job.id + (isFirstScan ? "_Prima Scansione" : ""); + initialBody[`Data_scansione_fallita__c`] = null; initialBody[`URL_scansione_fallita__c`] = null; - initialBody[`Versione_Crawler_${key}__c`] = - packageJSON?.dependencies["pa-website-validator"]?.split("#")[1] ?? ""; + initialBody[`Versione_Crawler_${key}__c`] = crawlerVersion; initialBody[`Criteri_Superati_Crawler_${key}__c`] = passedAuditsPercentage; initialBody[`Status_Generale_${key}__c`] = generalStatus; initialBody[`Data_Job_Crawler_${key}__c`] = new Date(job.end_at).getTime();