mirror of
https://github.com/ssyyhhrr/stewardle.git
synced 2025-11-17 14:23:40 -05:00
Metrics Tracking Fix
This commit is contained in:
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."
|
||||
}
|
||||
})
|
||||
let rawStatsFile = fs.readFileSync(statsPath)
|
||||
let statsFile = JSON.parse(rawStatsFile)
|
||||
let statsFile
|
||||
if (fs.existsSync(statsPath)) {
|
||||
let rawStatsFile = fs.readFileSync(statsPath)
|
||||
statsFile = JSON.parse(rawStatsFile)
|
||||
} else {
|
||||
statsFile = {}
|
||||
}
|
||||
let date = dayjs.format("YYYY-MM-DD")
|
||||
statsFile[date] = stats
|
||||
let newStatsFile = JSON.stringify(statsFile)
|
||||
|
||||
Reference in New Issue
Block a user