/* * Copyright (C) 2025 Jakub Žitník * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ import parseTeachers from "../utils/parseTeachers.js" import fs from "fs/promises"; const PREVIOUS = "db/v3/_previous.json"; export default async function parseV3(fileV2Path) { const previousStr = fs.readFile(PREVIOUS, { encoding: "utf8", }); const nowStr = fs.readFile(fileV2Path, { encoding: "utf8", }) const previous = JSON.parse(previousStr); const previousDays = previous.props.map(prop => prop.date); const now = JSON.parse(nowStr); for (const prop of now.props) { if (!previousDays.includes(prop.date)) { doWholeDay(prop); continue; } // TODO: Check for changes for each class, if any change is do the class (will do someday) } // CHANGE PREVIOUS TO NOW fs.copyFile(fileV2Path, PREVIOUS); }