Skip to content

Commit

Permalink
fixed formatting of cs and game-dev JSON and added more conditions wh…
Browse files Browse the repository at this point in the history
…en calling getRequiredCourses
  • Loading branch information
ShireenKumar committed Nov 18, 2024
1 parent 8572da4 commit 0dcd9c5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,50 +285,48 @@
"type": "XOM",
"numCreditsMin": 12,
"courses": [
[
{
"type": "RANGE",
"subject": "ARTD",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "ARTE",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "ARTF",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "ARTG",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "ARTH",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "GAME",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
}
],
{
"type": "RANGE",
"subject": "ARTD",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "ARTE",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "ARTF",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "ARTG",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "ARTH",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "GAME",
"idRangeStart": 0,
"idRangeEnd": 9999,
"exceptions": []
},
{
"type": "RANGE",
"subject": "CS",
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/utils/plan/getAllCoursesInMajor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const getAllCoursesInMajor = (
const majorRequirements = major.requirementSections.reduce(
(courses: IRequiredCourse[], section: Section) => {
const requiredCourses: IRequiredCourse[] = [];
getRequiredCourses(section.requirements, requiredCourses);
getRequiredCourses(section.requirements ?? [], requiredCourses);
return courses.concat(requiredCourses);
},
[]
Expand Down Expand Up @@ -54,9 +54,9 @@ const getRequiredCourses = (
} else if (requirement.type === "COURSE") {
requiredCourses.push(requirement);
} else if (requirement.type === "SECTION") {
getRequiredCourses(requirement.requirements, requiredCourses);
getRequiredCourses(requirement.requirements ?? [], requiredCourses);
} else {
getRequiredCourses(requirement.courses, requiredCourses);
getRequiredCourses(requirement.courses ?? [], requiredCourses);
}
}
};

0 comments on commit 0dcd9c5

Please sign in to comment.