mirror of
https://github.com/ssyyhhrr/stewardle.git
synced 2025-11-18 06:43:38 -05:00
Metrics Tracking Fix
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
node_modules
|
node_modules
|
||||||
driver.txt
|
driver.txt
|
||||||
drivers.json
|
drivers.json
|
||||||
|
stats.json
|
||||||
.idea
|
.idea
|
||||||
9
app.js
9
app.js
@@ -83,8 +83,13 @@ schedule.scheduleJob("0 0 * * *", async () => {
|
|||||||
throw "Ergast API is unreachable and the drivers.json cache has not been built. Please try again when the Ergast API is online."
|
throw "Ergast API is unreachable and the drivers.json cache has not been built. Please try again when the Ergast API is online."
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
let rawStatsFile = fs.readFileSync(statsPath)
|
let statsFile
|
||||||
let statsFile = JSON.parse(rawStatsFile)
|
if (fs.existsSync(statsPath)) {
|
||||||
|
let rawStatsFile = fs.readFileSync(statsPath)
|
||||||
|
statsFile = JSON.parse(rawStatsFile)
|
||||||
|
} else {
|
||||||
|
statsFile = {}
|
||||||
|
}
|
||||||
let date = dayjs.format("YYYY-MM-DD")
|
let date = dayjs.format("YYYY-MM-DD")
|
||||||
statsFile[date] = stats
|
statsFile[date] = stats
|
||||||
let newStatsFile = JSON.stringify(statsFile)
|
let newStatsFile = JSON.stringify(statsFile)
|
||||||
|
|||||||
Reference in New Issue
Block a user