Skip to content

Show students' Cal 1 Card photos to staff - #99

Open
rabiachadha wants to merge 3 commits into
mainfrom
rchadha-roster-photos
Open

rabiachadha wants to merge 3 commits into
mainfrom
rchadha-roster-photos

Conversation

@rabiachadha

Copy link
Copy Markdown

Closes #4

Staff now see each student's Cal 1 Card photo, so TAs can learn names. Students never see photos.

Where photos appear

  • Roster cards (Roster tab of a section)
  • Lab, discussion and tutoring attendance lists
  • A student's history page, when staff open it

Students without a photo get a gray placeholder.

How it works

  • SIDs: a new users.sid column (migration 0008_sid) is filled from Canvas's sis_user_id in three places:

    • when a student signs in. We confirmed bCourses returns sis_user_id on a student's own profile.
    • when staff add a student by email.
    • in the bCourses roster sync, so students who never sign in get one too.

    A missing SID never erases one we already have.

  • C1C: server/c1c_service.py fetches photos the same way seating does (server/services/c1c/__init__.py): GET {C1C_API_DOMAIN}/c1c-api/v1/photo/{sid} with basic auth, through C1C_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>/photo serves the photo only to staff in that course. It sends Cache-Control: private, max-age=3600 and saves nothing. SIDs are never sent to the browser.

  • Development: uses a drawn fake photo unless MOCK_C1C=false.

Not in this PR

  • Deploy settings. The C1C settings and secrets aren't added to the staging or production deploys yet, so deployed Sections shows placeholders until they are.
  • Real photos untested. Seating's proxy answered 407 Proxy Authentication Required from a laptop, so no real photo has come back yet. Waiting on Silas.

Testing

  • 249 unit tests, 18 e2e tests and the a11y audit pass. New: tests/unit/test_roster_photos.py, plus SID checks in the login, add-students, Canvas scopes and bCourses sync tests.
  • Checked by hand with the fake Canvas: CSV-imported students show placeholders. After "Sync bCourses Students", the synced students show photos on the roster, attendance and history pages without ever signing in.
  • This PR adds a migration, so its preview deploy will say the database needs migrating. Previews share the staging database and don't run migrations.

🤖 Generated with Claude Code

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-commenter

codecov-commenter commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.60%. Comparing base (c142bc3) to head (3fa27e7).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

🚀 Staging Preview Deployed!

URL: https://preview-sections-pr-99-137456085712.us-west1.run.app

rabiachadha and others added 2 commits November 17, 2026 00:30
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>
@pancakereport

Copy link
Copy Markdown

Seems like maybe we skip the proxy stuff?

@noahmhan noahmhan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add roster photos to Sections

4 participants