Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcarvajal committed Feb 9, 2025
1 parent 51d3f4e commit c62567f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/frontend/components/AddCourseModal/AddCourseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,15 @@ export const AddCourseModal: React.FC<AddCourseModalProps> = ({
setIsLoadingSelectCourse(true);

// grab any coreqs of the course that haven't already been selected/added to the term
const coreqs = courseCoreqsMap.get(course.id) || [];
const coreqs = isAutoSelectCoreqs
? (await getRequiredCourseCoreqs(course, catalogYear)).filter((coreq) => {
const isAlreadySelected = selectedCourses.find((selectedCourse) =>
isEqualCourses(selectedCourse, coreq)
);
const isAlreadyAdded = isCourseAlreadyAdded(coreq);
return !(isAlreadyAdded || isAlreadySelected);
})
: [];

const updatedSelectedCourses = [...selectedCourses, course, ...coreqs];

Expand Down

0 comments on commit c62567f

Please sign in to comment.