Skip to content

Commit 75be4f3

Browse files
committed
scheduler empty meetings array fix
1 parent 11b6979 commit 75be4f3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

apps/frontend/src/app/Schedule/Editor/SideBar/Class/Section/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ export default function Section({
2020
active,
2121
sectionId,
2222
number,
23-
meetings: [{ startTime, endTime, days }],
23+
meetings,
2424
}: SectionProps & ISection) {
25+
const meeting = meetings.length > 0 ? meetings[0] : null;
2526
return (
2627
<div
2728
className={classNames(styles.root, {
@@ -36,9 +37,9 @@ export default function Section({
3637
<p className={styles.title}>{number}</p>
3738
<CCN sectionId={sectionId} tooltip={false} />
3839
<Time
39-
endTime={endTime}
40-
startTime={startTime}
41-
days={days}
40+
endTime={meeting?.endTime ?? null}
41+
startTime={meeting?.startTime ?? null}
42+
days={meeting?.days ?? null}
4243
tooltip={false}
4344
className={styles.time}
4445
/>

apps/frontend/src/app/Schedule/Week/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export default function Week({
102102
// Filter sections for the current day which have a time specified
103103
.filter(
104104
(section) =>
105+
section.meetings.length > 0 &&
105106
section.meetings[0].days[day] &&
106107
section.meetings[0].startTime &&
107108
getY(section.meetings[0].startTime) > 0

0 commit comments

Comments
 (0)