From 344f1f2849778527fd4bd26387c00afdc6773ca3 Mon Sep 17 00:00:00 2001 From: imagine-hussain Date: Fri, 14 Jul 2023 20:30:38 +1000 Subject: [PATCH] fixed up dup check for lsh --- backend/server/routers/user.py | 6 ++---- frontend/src/utils/api/degreeApi.ts | 2 ++ frontend/src/utils/api/plannerApi.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/server/routers/user.py b/backend/server/routers/user.py index e36b28bbe..fcd176ff1 100644 --- a/backend/server/routers/user.py +++ b/backend/server/routers/user.py @@ -254,6 +254,7 @@ def reset(token: str = DUMMY_TOKEN): @router.post("/setupDegreeWizard", response_model=Storage) def setup_degree_wizard(wizard: DegreeWizardInfo, token: str = DUMMY_TOKEN): # validate + print("MADE INNER") num_years = wizard.endYear - wizard.startYear + 1 if num_years < 1: raise HTTPException(status_code=400, detail="Invalid year range") @@ -296,7 +297,7 @@ def setup_degree_wizard(wizard: DegreeWizardInfo, token: str = DUMMY_TOKEN): for actl_spec in specs.values() if ( actl_spec.get('is_optional') is False - and not actl_spec.get('specs', []).keys().intersection(wizard.specs) + and not set(actl_spec.get('specs', []).keys()).intersection(wizard.specs) ) ] @@ -304,9 +305,6 @@ def setup_degree_wizard(wizard: DegreeWizardInfo, token: str = DUMMY_TOKEN): # ceebs returning the bad data because FE should be valid anyways if invalid_lhs_specs or spec_reqs_not_met: raise HTTPException(status_code=400, detail="Invalid specialisations") - - if any(spec not in avail_spec_types for spec in wizard.specs): - raise HTTPException(status_code=400, detail="Invalid specialisations") print("Valid specs") planner: PlannerLocalStorage = { diff --git a/frontend/src/utils/api/degreeApi.ts b/frontend/src/utils/api/degreeApi.ts index 5264f647e..9079d484a 100644 --- a/frontend/src/utils/api/degreeApi.ts +++ b/frontend/src/utils/api/degreeApi.ts @@ -14,6 +14,8 @@ export const resetDegree = async () => { export const setupDegreeWizard = async (wizard: DegreeWizardPayload) => { const token = await getToken(); + // eslint-disable-next-line no-console + console.log('wiz: ', wizard); try { await axios.post('/user/setupDegreeWizard', wizard, { params: { token } }); } catch (err) { diff --git a/frontend/src/utils/api/plannerApi.ts b/frontend/src/utils/api/plannerApi.ts index 5da5b80d2..c49f0e58d 100644 --- a/frontend/src/utils/api/plannerApi.ts +++ b/frontend/src/utils/api/plannerApi.ts @@ -1,7 +1,7 @@ import axios from 'axios'; import { getToken } from './userApi'; -const handleAddToUnplanned = async (courseId: string) => { +export const handleAddToUnplanned = async (courseId: string) => { const token = await getToken(); try { await axios.post('planner/addToUnplanned', { courseCode: courseId }, { params: { token } }); @@ -11,4 +11,4 @@ const handleAddToUnplanned = async (courseId: string) => { } }; -export default handleAddToUnplanned; +export default { handleAddToUnplanned };