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

Invalid course code doesn't throw error #199

Closed ramanxg closed 2 years ago

ramanxg commented 2 years ago

When writing a query such as grades(year:"2020-21", department:"COMPSCI", code:"999939999"), this does not throw an error. There is an issue with the regex matching only a part of the string, so it thinks the code is valid, when it should throw an error.

rgandhasri87 commented 2 years ago

This is really late, but I'd like to claim this one.

rgandhasri87 commented 2 years ago

Has this issue been resolved already? The current regex matching string in grades.helper.ts is: ^\d{5}$ and I thought that should match the entire string. I also tested it in an online regex tester just to be sure and it seems to be working correctly (anything other than a 5 digit number sequence is not matched). Trying out a query on the PeterPortal GraphQL playground with a invalid course code (such 356600) also results in an error on there.

Perhaps I am not understanding the problem completely.

ramanxg commented 2 years ago

You're correct. seems like the issue was resolved already. You can take on another issue and don't worry about the due date.