From a942818247bfa5db675d78c9b1fd74f32f5b1f45 Mon Sep 17 00:00:00 2001 From: jzitnik-dev Date: Tue, 21 Oct 2025 19:35:45 +0200 Subject: [PATCH] feat: Last update --- scrape/parse.js | 6 ++++++ server.js | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) 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); });