From 4a817c69d9deea6f2b096acf368942cc8fc27f55 Mon Sep 17 00:00:00 2001 From: Julian Weng Date: Fri, 1 Dec 2023 18:52:00 -0500 Subject: [PATCH] Change remove_clubs_from_exception to detail=false, fix checkbox state management --- backend/clubs/views.py | 2 +- .../Settings/WhartonApplicationCycles.tsx | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/backend/clubs/views.py b/backend/clubs/views.py index 05cc947cd..80f45b3bc 100644 --- a/backend/clubs/views.py +++ b/backend/clubs/views.py @@ -5098,7 +5098,7 @@ def add_clubs_to_exception(self, *args, **kwargs): ) return Response([]) - @action(detail=True, methods=["post"]) + @action(detail=False, methods=["post"]) def remove_clubs_from_exception(self, *args, **kwargs): """ Remove selected clubs from application cycle deadline exemption diff --git a/frontend/components/Settings/WhartonApplicationCycles.tsx b/frontend/components/Settings/WhartonApplicationCycles.tsx index 8397b21dd..65c1a4a50 100644 --- a/frontend/components/Settings/WhartonApplicationCycles.tsx +++ b/frontend/components/Settings/WhartonApplicationCycles.tsx @@ -112,13 +112,10 @@ const WhartonApplicationCycles = (): ReactElement => { }) } if (clubsNoExceptions.length > 0) { - doApiRequest( - `/cycles/${extensionsCycle.id}/remove_clubs_from_exception/`, - { - method: 'POST', - body: { clubs: clubsNoExceptions.map((x) => x.id) }, - }, - ) + doApiRequest(`/cycles/remove_clubs_from_exception/`, { + method: 'POST', + body: { clubs: clubsNoExceptions.map((x) => x.id) }, + }) } } @@ -132,7 +129,7 @@ const WhartonApplicationCycles = (): ReactElement => { }), ) }) - }, [clubOptionsMembership]) + }, []) useEffect(() => { if (membershipCycle && membershipCycle.id != null) { @@ -264,13 +261,13 @@ const WhartonApplicationCycles = (): ReactElement => { setClubsExtensions([...clubsExtensions]) }} /> - {/* {club.endDate} */} { club.exception = e.target.checked club.changed = true + setClubsExtensions([...clubsExtensions]) }} checked={ club.exception != null ? club.exception : false