Closed aquonbovell closed 3 months ago
the only thing i am thinking is that the array is coming back empty. The problem is either here:
getCourses(
program.requirements.flatMap((req) =>
req.type === 'CREDITS' && 'courses' in req.details ? req.details.courses : []
)
),
or
async function getCourses(courseIds: string[]): Promise<CourseWithPrerequisites[]> {
const [courses, prerequisites] = await Promise.all([
db.selectFrom('Course').where('id', 'in', courseIds).selectAll().execute(),
db
.selectFrom('CoursePrerequisite as CP')
.innerJoin('Course as C', 'CP.prerequisiteId', 'C.id')
.where('CP.courseId', 'in', courseIds)
//...
but from me looking at what was saved, it looks correct
{
"id": "7ad333a2-e383-453c-b0e0-6d5b7debc303",
"programId": "2d334c72-bf96-413a-a73a-d40bcb14068d",
"type": "CREDITS",
"credits": 24,
"details": {
"courses": [
"9290",
"7719",
"12966",
"7720",
"12994",
"378",
"12993",
"12992"
]
}
},
The error was thrown in the get courses function. So maybe it's there.
I'll take a slower look later
Can you check the getCourses function, it is working for those majors that have electives @ level 1. But fails for those non elective ones (Biochemistry).
Here is the error: