New stats

This commit is contained in:
Pieter Vander Vennet 2022-07-29 23:25:22 +02:00
parent 1ff03d9bd0
commit 20292c9bd1

View file

@ -46,9 +46,21 @@ class StatsDownloader {
} }
const path = `${this._targetDirectory}/stats.${year}-${month}-${(day < 10 ? "0" : "") + day}.json` const path = `${this._targetDirectory}/stats.${year}-${month}-${(day < 10 ? "0" : "") + day}.json`
if(existsSync(path)){ if(existsSync(path)){
console.log("Skipping ", path,": already exists")
continue continue
} }
try{
await this.DownloadStatsForDay(year, month, day, path) await this.DownloadStatsForDay(year, month, day, path)
}catch(e){
console.error(e)
console.error("Could not download "+year+"-"+month+"-"+day+"... Trying again")
try{
await this.DownloadStatsForDay(year, month, day, path)
}catch(e){
console.error("Could not download "+year+"-"+month+"-"+day+", skipping for now")
}
}
} }
} }
} }
@ -828,6 +840,10 @@ async function main(): Promise<void> {
if (process.argv.indexOf("--no-graphs") >= 0) { if (process.argv.indexOf("--no-graphs") >= 0) {
return return
} }
const allFiles = readdirSync("Docs/Tools/stats").filter(p => p.endsWith(".json"))
writeFileSync("Docs/Tools/stats/file-overview.json", JSON.stringify(allFiles))
/*
await createMiscGraphs(allFeatures, emptyCS) await createMiscGraphs(allFeatures, emptyCS)
const grbOnly = allFeatures.filter(f => f.properties.metadata.theme === "grb") const grbOnly = allFeatures.filter(f => f.properties.metadata.theme === "grb")
@ -838,7 +854,7 @@ async function main(): Promise<void> {
await createGraphs(allFeatures.filter(f => f.properties.date.startsWith("2022")), " in 2022") await createGraphs(allFeatures.filter(f => f.properties.date.startsWith("2022")), " in 2022")
await createGraphs(allFeatures.filter(f => f.properties.metadata.theme === "toerisme_vlaanderen"), " met pin je punt", 0) await createGraphs(allFeatures.filter(f => f.properties.metadata.theme === "toerisme_vlaanderen"), " met pin je punt", 0)
await createGraphs(grbOnly, " with the GRB import tool", 0) await createGraphs(grbOnly, " with the GRB import tool", 0)
*/
} }
main().then(_ => console.log("All done!")) main().then(_ => console.log("All done!"))