icssc / peterportal-public-api

API that provides easy-access to UC Irvine data such as: courses, professors, grade distribution, schedule of classes, and more
https://api.peterportal.org/
MIT License
23 stars 11 forks source link

Cannot read course id null #188

Open ramanxg opened 2 years ago

ramanxg commented 2 years ago

For queries to websoc, some courses we don't have in our cache, and this throws an error.

This is the error message:

Cannot read property 'id' of null"

Example query:

{
  schedule(year:2020, quarter:"Fall", department:"COMPSCI", course_number:"275") {
     course {
      id
      department
      course_level
      description
    }
  }
}
ramanxg commented 2 years ago

In schedule.helper.ts under getCourseSchedules. getCourse will sometimes return null, if it's not in our cache. If it's null, we can return what we can: id, title, department, number.