From 45c939ef473a74cc37c889722cdc46b7ea7c282a Mon Sep 17 00:00:00 2001 From: jobvengalil <147741937+jobvengalil@users.noreply.github.com> Date: Fri, 24 Apr 2026 13:02:43 -0400 Subject: [PATCH] fix/CSV Export --- backend/app/routers/schedule.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/backend/app/routers/schedule.py b/backend/app/routers/schedule.py index 83d64bf..77e3319 100644 --- a/backend/app/routers/schedule.py +++ b/backend/app/routers/schedule.py @@ -159,14 +159,17 @@ def _safe(v: object) -> str: ) for section in sections: - raw_tb = tb_by_id.get(section.time_block.time_block_id) - if raw_tb and raw_tb.block_group: - siblings = tb_by_group.get(raw_tb.block_group, [raw_tb]) - time_block = " / ".join(f"{p.meeting_days} {_fmt(p.start_time)}-{_fmt(p.end_time)}" for p in siblings) - elif raw_tb: - time_block = f"{raw_tb.meeting_days} {_fmt(raw_tb.start_time)}-{_fmt(raw_tb.end_time)}" + if section.time_block is None: + time_block = "" else: - time_block = f"{section.time_block.days} {section.time_block.start_time}-{section.time_block.end_time}" + raw_tb = tb_by_id.get(section.time_block.time_block_id) + if raw_tb and raw_tb.block_group: + siblings = tb_by_group.get(raw_tb.block_group, [raw_tb]) + time_block = " / ".join(f"{p.meeting_days} {_fmt(p.start_time)}-{_fmt(p.end_time)}" for p in siblings) + elif raw_tb: + time_block = f"{raw_tb.meeting_days} {_fmt(raw_tb.start_time)}-{_fmt(raw_tb.end_time)}" + else: + time_block = f"{section.time_block.days} {section.time_block.start_time}-{section.time_block.end_time}" instructors = sorted(section.instructors, key=lambda i: (i.last_name, i.nuid)) if instructors: