Skip to content

Commit 9816982

Browse files
authored
Merge pull request #625 from pennlabs/aag/frontend-fixes
Frontend fixes
2 parents d668040 + 62acb4b commit 9816982

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

backend/degree/static/pdp/degree-editor.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,10 @@ const LayoutFlow = () => {
7878
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
7979

8080
const onConnect = useCallback((params) => {
81-
console.log("onConnect", params);
8281
if (params.source === params.target) return;
8382
const [sourceIsDegree, sourceId] = pkOfNodeId(params.source);
8483
const [targetIsDegree, targetId] = pkOfNodeId(params.target);
8584
if (sourceIsDegree || targetIsDegree) return;
86-
console.log("HERE");
8785
const redirect = `/admin/degree/doublecountrestriction/add/?rule=${sourceId}&other_rule=${targetId}`;
8886
window.location.href = redirect;
8987
}, []);

frontend/degree-plan/components/FourYearPlan/Semesters.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Select from "react-select";
88
import { ModalKey } from "./DegreeModal";
99

1010
const getNextSemester = (semester: string) => {
11-
console.log("GET NEXT SEMESTER");
1211
const year = parseInt(semester.slice(0, 4));
1312
const season = semester.slice(4);
1413
if (season === "A") {
@@ -238,10 +237,10 @@ const Semesters = ({
238237
let parsed;
239238
try {
240239
parsed = JSON.parse(stickyValue)
240+
setSemesters(parsed)
241241
} catch {
242242
setSemesters(getDefaultSemesters());
243243
}
244-
setSemesters(parsed);
245244
}, [activeDegreeplan, currentSemester]);
246245

247246
/** Update semesters to local storage */
@@ -250,7 +249,7 @@ const Semesters = ({
250249
// if finish loading and no semesters, we go to edit mode for the user to add new semesters
251250
else setEditMode(false);
252251
if (!activeDegreeplan) return;
253-
if (typeof window !== undefined) {
252+
if (typeof window !== "undefined" && Object.keys(semesters).length) {
254253
localStorage.setItem(
255254
getLocalSemestersKey(activeDegreeplan.id),
256255
JSON.stringify(semesters)

frontend/degree-plan/components/FourYearPlanPage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ const FourYearPlanPage = ({
7474
if (!isLoadingDegreeplans && !degreeplans?.length) {
7575
setShowOnboardingModal(true);
7676
}
77-
console.log(activeDegreeplan)
7877
if (!degreeplans?.length) {
7978
setActiveDegreeplan(null);
8079
} else if (

frontend/degree-plan/components/Requirements/CourseInReq.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const CourseInReq = (props : CourseInReqProps) => {
3535
/** If the current rule about to be removed is the only rule
3636
* the course satisfied, then we delete the fulfillment */
3737
if (updated_rules && updated_rules.length == 0) {
38-
console.log('hwere')
3938
removeFulfillment(full_code);
4039
} else {
4140
updateFulfillment({rules: updated_rules}, full_code);

frontend/degree-plan/components/Requirements/QObject.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ const QObject = ({ q, fulfillments, rule, satisfied, activeDegreePlanId }: QObje
314314
case "COURSE":
315315
const [fulfillment] = fulfillments.filter(fulfillment => fulfillment.full_code == q.full_code && (!q.semester || q.semester === fulfillment.semester))
316316
return <CourseInReq course={{...q, rules: fulfillment ? fulfillment.rules : []}} fulfillment={fulfillment} isDisabled={satisfied && !fulfillment} isUsed={!!fulfillment} rule_id={rule.id} activeDegreePlanId={activeDegreePlanId}/>;
317-
// onClick={() => { console.log("fired"); createOrUpdate({ rules: [rule.id] }, q.full_code)}}
318317
}
319318
}
320319

@@ -351,8 +350,6 @@ const RuleLeaf = ({ q_json, fulfillmentsForRule, rule, satisfied, activeDegreePl
351350
const t3 = transformSearchConditions(t2)
352351
q_json = t3 as TransformedQObject;
353352

354-
// console.log(q_json)
355-
356353
return (
357354
<RuleLeafWrapper $wrap>
358355
<QObject q={q_json} fulfillments={fulfillmentsForRule} rule={rule} satisfied={satisfied} activeDegreePlanId={activeDegreePlanId} />

frontend/degree-plan/pages/OnboardingPage.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ const OnboardingPage = ({
250250
/** Filter major options based on selected schools/degrees */
251251
const majorOptions =
252252
degrees
253-
?.filter((d) => d.year == startingYear?.value && schools.map((s) => s.value).includes(d.degree))
253+
?.filter((d) => schools.map((s) => s.value).includes(d.degree))
254+
.sort((d) => Math.abs((startingYear ? startingYear.value : d.year) - d.year))
254255
.map((degree) => ({
255256
value: degree,
256257
label: createMajorLabel(degree),
@@ -268,6 +269,11 @@ const OnboardingPage = ({
268269
getLocalSemestersKey(res.id),
269270
JSON.stringify(interpolateSemesters(startingYear.value, graduationYear.value))
270271
);
272+
console.log(
273+
"****",
274+
getLocalSemestersKey(res.id),
275+
JSON.stringify(interpolateSemesters(startingYear.value, graduationYear.value))
276+
);
271277
}
272278
setActiveDegreeplan(res);
273279
const updated = postFetcher(

0 commit comments

Comments
 (0)