perf: Do not read worksheet twice
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ExcelJS, { Worksheet } from "exceljs"
|
||||
import { Workbook, Worksheet } from "exceljs"
|
||||
import fs from "fs"
|
||||
import parseAbsence, { AbsenceResult } from "../utils/parseAbsence.js"
|
||||
import parseTeachers from "../utils/parseTeachers.js"
|
||||
@@ -27,9 +27,7 @@ interface ScheduleDay {
|
||||
ABSENCE?: AbsenceResult[];
|
||||
}
|
||||
|
||||
export default async function parseV1V2(downloadedFilePath: string) {
|
||||
const workbook = new ExcelJS.Workbook();
|
||||
await workbook.xlsx.readFile(downloadedFilePath);
|
||||
export default async function parseV1V2(workbook: Workbook) {
|
||||
const teacherMap = await parseTeachers();
|
||||
|
||||
const dateRegex = /^(pondělí|úterý|středa|čtvrtek|pátek|po|út|ut|st|čt|ct|pa|pá)\s+(\d{1,2})\.\s*(\d{1,2})\.\s*(\d{4}|\d{2})/i;
|
||||
|
||||
Reference in New Issue
Block a user