Skip to content

Commit

Permalink
Merge pull request #44 from italia/feat/update_report_naming
Browse files Browse the repository at this point in the history
feat: report file name update
  • Loading branch information
simone-amadio-acn authored Dec 19, 2023
2 parents 5fbf52c + 8d8a9e9 commit 139be5a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
23 changes: 19 additions & 4 deletions utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 139be5a

Please sign in to comment.