From ec1b24f8b8bf3403679970919814d2c4e1bbd6c3 Mon Sep 17 00:00:00 2001 From: Andrew Smithwick Date: Mon, 15 Apr 2024 19:42:13 -0700 Subject: [PATCH] Make full pickup events not show on cart page --- src/pages/store/cart.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/store/cart.tsx b/src/pages/store/cart.tsx index bfad5e6e..ca1f1d32 100644 --- a/src/pages/store/cart.tsx +++ b/src/pages/store/cart.tsx @@ -249,7 +249,11 @@ const getServerSidePropsFunc: GetServerSideProps = async ({ req, res }) => { const savedCartPromise = CartService.getCart({ req, res }); const pickupEventsPromise = getFutureOrderPickupEvents(AUTH_TOKEN).then(events => - events.filter(event => event.status !== 'CANCELLED') + events + .filter(event => event.status !== 'CANCELLED') + .filter( + event => (event.orders?.length ?? 0) <= (event?.orderLimit ?? Number.MAX_SAFE_INTEGER) + ) ); const userPromise = getCurrentUserAndRefreshCookie(AUTH_TOKEN, { req, res });