From f4eeb1153674a753757bd8eb00160deb84f1f984 Mon Sep 17 00:00:00 2001 From: Shikhar Date: Tue, 7 Jan 2025 20:09:55 +0530 Subject: [PATCH] small fix in parsing logic Signed-off-by: Shikhar --- timetable/extractor.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/timetable/extractor.py b/timetable/extractor.py index 328102f..e5de605 100644 --- a/timetable/extractor.py +++ b/timetable/extractor.py @@ -17,6 +17,7 @@ class Course: start_time: int location: str duration: int = 0 + cell_dur: int = 0 def get_location(self) -> str: # TODO: more logic to specify other locations if possible @@ -103,10 +104,16 @@ def build_courses(html: str, course_names: dict) -> list[Course]: if prev: # encountered a new course, commit the previous course courses.append(prev) # reinstantiate the prev course + + start_time = timings[index] + if(prev and prev.cell_dur>1): + start_time+=prev.cell_dur-1 + prev = Course(code=code, name=course_names.get(code, ""), day=day, - start_time=timings[index], + start_time=start_time, location=location) prev.duration = cell_duration + prev.cell_dur = cell_duration # end of the day: commit the last course if prev: