Skip to content

Commit

Permalink
fixed up dup check for lsh
Browse files Browse the repository at this point in the history
  • Loading branch information
imagine-hussain committed Jul 14, 2023
1 parent 1941295 commit 344f1f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 2 additions & 4 deletions backend/server/routers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -296,17 +297,14 @@ 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)
)

]

# 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 = {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/utils/api/degreeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/utils/api/plannerApi.ts
Original file line number Diff line number Diff line change
@@ -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 } });
Expand All @@ -11,4 +11,4 @@ const handleAddToUnplanned = async (courseId: string) => {
}
};

export default handleAddToUnplanned;
export default { handleAddToUnplanned };

0 comments on commit 344f1f2

Please sign in to comment.