diff --git a/scrape/parse.js b/scrape/parse.js index 8641abd..64942f4 100644 --- a/scrape/parse.js +++ b/scrape/parse.js @@ -166,6 +166,9 @@ export default async function parseThisShit(downloadedFilePath) { finalIndex++; } + const currentDate = new Date(); + const formattedDate = currentDate.getHours().padStart(2, "0") + ":" + currentDate.getMinutes().padStart(2, "0"); + const data = { schedule: final, props: upcomingSheets.map((str) => { @@ -194,6 +197,9 @@ export default async function parseThisShit(downloadedFilePath) { priprava: isPriprava, }; }), + status: { + lastUpdated: formattedDate, + } } fs.writeFileSync("db/current.json", JSON.stringify(data)); diff --git a/server.js b/server.js index 228108e..40b01b1 100644 --- a/server.js +++ b/server.js @@ -10,9 +10,7 @@ app.get('/', async (_, res) => { const dataStr = await fs.readFile(path.join(process.cwd(), "db", "current.json"), "utf8"); const data = JSON.parse(dataStr); - data["status"] = { - currentUpdateSchedule: getCurrentInterval(), - }; + data["status"]["currentUpdateSchedule"] = getCurrentInterval(); res.json(data); });