- {courses
- .sort((a, b) => {
- const getTerm = (course: ICourse) => {
- return [...course.classes].sort(
- (a, b) =>
- a.year - b.year || score[a.semester] - score[b.semester]
- )[0];
- };
-
- return (
- getTerm(b).year - getTerm(a).year ||
- score[getTerm(b).semester] - score[getTerm(a).semester]
- );
- })
- .map((course) => {
- const { year, semester } = [...course.classes].sort(
- (a, b) =>
- a.year - b.year || score[a.semester] - score[b.semester]
- )[0];
-
- const { unitsMax, unitsMin } = course.classes.reduce(
- (acc, { unitsMax, unitsMin }) => ({
- unitsMax: Math.max(acc.unitsMax, unitsMax),
- unitsMin: Math.min(acc.unitsMin, unitsMin),
- }),
- { unitsMax: 0, unitsMin: 0 }
- );
-
- return (
-
-
-
- {course.subject} {course.number}
-
-
{course.title}
-
-
-
-
- {semester} {year}
-
-
-
-
-
- );
- })}
+
+ {results.map((result) => (
+
+
{result.model}
+ {result.courses.map((course, index) => (
+
+
+
+ {course.subject} {course.number}
+
+
{course.title}
+
+
+ ))}
-
-
-
+ ))}
+