Skip to content

Commit d2149a8

Browse files
Merge pull request #150 from metakgp/buggie
small fix in parsing logic
2 parents 16cff62 + f4eeb11 commit d2149a8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

timetable/extractor.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Course:
1717
start_time: int
1818
location: str
1919
duration: int = 0
20+
cell_dur: int = 0
2021

2122
def get_location(self) -> str:
2223
# TODO: more logic to specify other locations if possible
@@ -103,10 +104,16 @@ def build_courses(html: str, course_names: dict) -> list[Course]:
103104
if prev: # encountered a new course, commit the previous course
104105
courses.append(prev)
105106
# reinstantiate the prev course
107+
108+
start_time = timings[index]
109+
if(prev and prev.cell_dur>1):
110+
start_time+=prev.cell_dur-1
111+
106112
prev = Course(code=code, name=course_names.get(code, ""), day=day,
107-
start_time=timings[index],
113+
start_time=start_time,
108114
location=location)
109115
prev.duration = cell_duration
116+
prev.cell_dur = cell_duration
110117

111118
# end of the day: commit the last course
112119
if prev:

0 commit comments

Comments
 (0)