From 4499ee5809b2d72c689e7115fb560388c22c225c Mon Sep 17 00:00:00 2001 From: Josho <48394084+JoshoTheMosho@users.noreply.github.com> Date: Sat, 9 Sep 2023 22:58:33 -0700 Subject: [PATCH 1/2] Fix sectionFull conditionals --- src/pages/scheduler/components/SchedulerSections.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/scheduler/components/SchedulerSections.tsx b/src/pages/scheduler/components/SchedulerSections.tsx index b9af2968..c3833a0c 100644 --- a/src/pages/scheduler/components/SchedulerSections.tsx +++ b/src/pages/scheduler/components/SchedulerSections.tsx @@ -155,8 +155,8 @@ export const Option = forwardRef(function Option( ?.trim() ?.replace(/^(.{200}).+/, '$1…'); - const sectionFull = seats?.enrollment === seats?.maxEnrollment; - const waitlistFull = seats?.waitCount === seats?.waitCapacity; + const sectionFull = seats?.enrollment >= seats?.maxEnrollment; + const waitlistFull = seats?.waitCount >= seats?.waitCapacity; function Time({ time }: { time: string }) { const [start, end] = time.split('-'); From 83aefbc59f90d40e5e68aef69c8e9c640272b60f Mon Sep 17 00:00:00 2001 From: Josho <48394084+JoshoTheMosho@users.noreply.github.com> Date: Sat, 9 Sep 2023 23:35:24 -0700 Subject: [PATCH 2/2] Handle undefined correctly for greater than/equal to --- src/pages/scheduler/components/SchedulerSections.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/scheduler/components/SchedulerSections.tsx b/src/pages/scheduler/components/SchedulerSections.tsx index c3833a0c..55b2035d 100644 --- a/src/pages/scheduler/components/SchedulerSections.tsx +++ b/src/pages/scheduler/components/SchedulerSections.tsx @@ -155,8 +155,8 @@ export const Option = forwardRef(function Option( ?.trim() ?.replace(/^(.{200}).+/, '$1…'); - const sectionFull = seats?.enrollment >= seats?.maxEnrollment; - const waitlistFull = seats?.waitCount >= seats?.waitCapacity; + const sectionFull = (seats?.enrollment ?? 0) >= (seats?.maxEnrollment ?? 0); + const waitlistFull = (seats?.waitCount ?? 0) >= (seats?.waitCapacity ?? 0); function Time({ time }: { time: string }) { const [start, end] = time.split('-');