Repository navigation
Show students' Cal 1 Card photos to staff - #99
rabiachadha wants to merge 3 commits into
Conversation
Staff see each student's photo on the roster cards, the attendance lists
and the student's history page, with a placeholder when there's none.
- Store each student's SID (Canvas's sis_user_id) at login, when staff add
them by email, and in the bCourses roster sync, so students who never
sign in get one too (migration 0008_sid).
- c1c_service.py fetches photos from the C1C API the way seating does:
/c1c-api/v1/photo/{sid}, basic auth, through C1C_PROXY_URL, with the
same settings. Development uses a drawn fake unless MOCK_C1C=false.
- GET /api/students/<id>/photo serves a photo to staff in the course
only, with Cache-Control: private, and nothing is saved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #99 +/- ##
==========================================
+ Coverage 86.32% 86.60% +0.27%
==========================================
Files 31 33 +2
Lines 2494 2545 +51
==========================================
+ Hits 2153 2204 +51
Misses 341 341 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🚀 Staging Preview Deployed! URL: https://preview-sections-pr-99-137456085712.us-west1.run.app |
Covers its downgrade(), the two lines Codecov reported as untested, as test_staff_url_keeps_the_61a_link does for 0005_staff_url. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Students without a photo now show seating's gray silhouette (server/static/img/photo-placeholder.png) instead of a drawn icon, so both apps look the same. One <img> now switches its src on a 404. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Seems like maybe we skip the proxy stuff? |
noahmhan
left a comment
There was a problem hiding this comment.
Thank you for the work Rabia! Overall it looks good, but I have a couple suggestions:
I think the API requests for getting images are currently synchronous so they'll hold server threads and other requests might be blocked for a long time while waiting on the C1C photos. If we can lazily load the photos and asynchronously decode them as well as shorten the timeouts for the requests, it should help make sure there aren't concurrency issues. Also logging latency or if there are timeouts can help catch issues if they come up.
Closes #4
Staff now see each student's Cal 1 Card photo, so TAs can learn names. Students never see photos.
Where photos appear
Students without a photo get a gray placeholder.
How it works
SIDs: a new
users.sidcolumn (migration0008_sid) is filled from Canvas'ssis_user_idin three places:sis_user_idon a student's own profile.A missing SID never erases one we already have.
C1C:
server/c1c_service.pyfetches photos the same way seating does (server/services/c1c/__init__.py):GET {C1C_API_DOMAIN}/c1c-api/v1/photo/{sid}with basic auth, throughC1C_PROXY_URL, with a 10-second timeout. Any failure means no photo. The setting names match seating's.Route:
GET /offerings/<id>/api/students/<user_id>/photoserves the photo only to staff in that course. It sendsCache-Control: private, max-age=3600and saves nothing. SIDs are never sent to the browser.Development: uses a drawn fake photo unless
MOCK_C1C=false.Not in this PR
407 Proxy Authentication Requiredfrom a laptop, so no real photo has come back yet. Waiting on Silas.Testing
tests/unit/test_roster_photos.py, plus SID checks in the login, add-students, Canvas scopes and bCourses sync tests.🤖 Generated with Claude Code