Tig 209 tiger path egr course sliding window#519
Conversation
… only), and add owner (owners only). Meant for owner > admin hierarchy
The OIT MobileApp API (error 900908 unauthorized) has been replaced
with the Princeton registrar front-end API, which requires no OIT
subscription and is publicly accessible via Bearer token.
- scrape_registrar.py: use cloudscraper to bypass Cloudflare and
extract apiToken and apiBaseUrl from registrar.princeton.edu;
add get_course_ids_for_term() via /classes/{term} endpoint;
add get_full_course_details() returning all course fields in one call
- scrape_parse.py: remove MobileApp dependency entirely; derive
semester dates from term code; use registrar API in parallel
- scrape_all.py: warn and skip instead of crashing on 0-course terms
(historical terms 1214-1234 are not in the registrar API)
- requirements.txt: add cloudscraper==1.2.71
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…GR-CourseSlidingWindow
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bc8988e16
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| .then((data) => { | ||
| setDetails(data); | ||
| setLoading(false); |
There was a problem hiding this comment.
Guard detail fetch against out-of-order responses
Each course selection triggers a new fetch, but prior requests are never cancelled or ignored; if a user clicks courses quickly, an older response can resolve last and overwrite details for the currently selected course. In that case the panel can display ratings/comments from course A while the header still shows course B, which is a correctness issue in normal interactive use.
Useful? React with 👍 / 👎.
| if not evaluations: | ||
| return JsonResponse(empty) |
There was a problem hiding this comment.
Continue building details when evaluations are empty
This early return exits before the DB description lookup and course metadata enrichment, so courses with no evaluation rows always get an empty payload even when a description exists locally. The UI explicitly supports rendering description without eval data, so this branch drops useful details for exactly that case.
Useful? React with 👍 / 👎.
| evaluations.sort(key=lambda e: e.get("evalTerm", ""), reverse=True) | ||
| raw_rating = evaluations[0].get("rating") | ||
| rating = round(float(raw_rating), 2) if raw_rating is not None else None | ||
| return course_id, rating |
There was a problem hiding this comment.
Cache fetched ratings in _fetch_quality_rating
The helper checks course_details_* cache but never stores successful fetches back into that key. As a result, callers like get_schedule repeatedly hit the external evaluations API for the same courses (especially when quality_rating is missing or null), which adds avoidable latency and external load instead of converging to cache hits.
Useful? React with 👍 / 👎.
No description provided.