Skip to content

Commit

Permalink
Merge pull request #150 from metakgp/buggie
Browse files Browse the repository at this point in the history
small fix in parsing logic
  • Loading branch information
harshkhandeparkar authored Jan 7, 2025
2 parents 16cff62 + f4eeb11 commit d2149a8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion timetable/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d2149a8

Please sign in to comment.