feat(parser): update group parsing to handle special cases and improve regex patterns
feat(parser): enhance details extraction for lessons, including handling of subgroups and room moves feat(timetable): integrate room and teacher retrieval based on week context test(parser): add tests for group parsing with special characters and room move scenarios test(formats): implement tests for various lesson formats and their expected outputs feat(rooms): introduce room management functions for handling moves and week-based plans
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { parseWeekRanges, weekday, DATE_LIST } from "../shared/weeks.js";
|
||||
import { roomMoves } from "./rooms.js";
|
||||
|
||||
// The parser never guesses: a cell it cannot read becomes a lesson "every week" or keeps its
|
||||
// whole text as the subject. These checks find such cells after parsing, so a new format or a
|
||||
@@ -53,7 +54,9 @@ export function diagnose(schedule) {
|
||||
add("weeks_out_of_range", lesson, { condition: lesson.condition });
|
||||
DATE_LIST.lastIndex = 0;
|
||||
}
|
||||
if (!dated && !lesson.condition && (MONTHS.test(raw) || /\b\d{1,2}\.\d{2}\.\d{4}\b/.test(raw)))
|
||||
// A move to another room on a date ("412н 26.10.2026-333") is read, not a lesson date.
|
||||
const undated = roomMoves(raw).rest;
|
||||
if (!dated && !lesson.condition && (MONTHS.test(undated) || /\b\d{1,2}\.\d{2}\.\d{4}\b/.test(undated)))
|
||||
add("dates_unread", lesson);
|
||||
for (const date of lesson.date ? [lesson.date] : lesson.dates || []) {
|
||||
if (weekday(date) !== lesson.day) add("date_weekday", lesson, { date });
|
||||
|
||||
Reference in New Issue
Block a user