icssc / peterportal-api-next

API that provides easy access to public data from UC Irvine. Developed for Anteaters, by Anteaters.
https://docs.icssc.club/anteaterapi
MIT License
6 stars 0 forks source link

Use cache to send discussions and labs when requesting GEs #27

Closed MinhxNguyen7 closed 1 year ago

MinhxNguyen7 commented 1 year ago

When searching for GEs, WebSOC only returns lectures, no co-courses (discussions, labs, etc.), and that's what PeterPortal returns from its endpoint right now. AntAlamanac requests information for each course individually after the initial GE request, resulting in many extraneous requests.

Now that there's a WebSOC cache, co-courses can be included in the response for GEs. To maintain parity with WebSOC functionality, @ecxyzzy says that a flag should be used to enable this behavior, and lecture-only should be the default.

ap0nia commented 1 year ago

This is definitely the most ideal place to implement this feature. However, because AA does have a dedicated backend, I’ve implemented a rudimentary solution for AA here https://github.com/icssc/AntAlmanac/blob/aponia-monorepo/apps/server/src/services/schedule.ts

Since the AA backend can proxy requests to other backend services, it’ll appear as a single query to the AA server on the front end. Regardless of peterportal’s api, we should be using this proxy strat to simplify front end logic anyways.

In any case, it would definitely be a lot nicer for AA’s backend to not have to go through that trouble of manually querying all that info

MinhxNguyen7 commented 1 year ago

This is definitely the most ideal place to implement this feature. However, because AA does have a dedicated backend, I’ve implemented a rudimentary solution for AA here https://github.com/icssc/AntAlmanac/blob/aponia-monorepo/apps/server/src/services/schedule.ts

I neglected to mention that we lazy-load it right now as you scroll down the GE list. When you make that many requests to WebSOC, you're bound to get something that takes a while, and you don't want the user to sit around when it's loading.

Also, on an unrelated note, WebSOC stands for Web Schedule of Classes btw.