Skip to content

Commit

Permalink
fix: sitiming import accept new format with splits included
Browse files Browse the repository at this point in the history
  • Loading branch information
brownben committed Dec 5, 2024
1 parent a5abe7a commit 535a77f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/src/utils/import_file/import_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,18 @@ def parse_sitiming_file(file: str) -> tuple[list[str], list[list[str]]]:
block.find("h3").text
for block in document.find_all("div", attrs={"class": "results-block"})
]

number_of_headings = len(table_headings) - 1
for results, course in zip(course_results, courses):
for row in results:
while len(row) < len(table_headings) - 1:
while len(row) < number_of_headings:
# add extra column for when behind is missing for some results
row.append("")

while len(row) > number_of_headings:
# if splits are included remove them
row.pop()

row.append(course)

return (
Expand Down

0 comments on commit 535a77f

Please sign in to comment.