Skip to content

Export every student's sections, and find a student's sections - #91

Merged
pancakereport merged 12 commits into
mainfrom
student-export-search
Nov 13, 2026
Merged

pancakereport merged 12 commits into
mainfrom
student-export-search

Conversation

@pancakereport

@pancakereport pancakereport commented Nov 12, 2026 •

Copy link
Copy Markdown

Closes #5.

What's new

Export Students (Admin → Roster Management, next to the other exports, admins only): a students.csv with one row per student in the offering. It has columns Name, Email, then one column per section type the course has (Lab, Discussion, Tutoring). Each cell gives the section ("Yu Long, M 08:00a, Soda 271"), or Floating if the student has no lab or discussion section. Tutoring is opt-in, so a student without one gets a blank cell, not Floating. Staff are left out.

Find a student (Roster Management): search by part of a name or email. Each result links to the student's history page and lists their sections in this offering, each linking to its section page. It shows "Lab: Floating" / "Discussion: Floating" for the types the course has. The search_students API is staff-only and returns up to 25 matches. % and _ are matched literally.

From the issue's comments

  • Accurate "Floating" via the bCourses sync: the sync landed in Sync an offering's students with its bCourses roster #70. It adds students new on bCourses and removes dropped ones from the offering and its sections, so the export reflects bCourses as of the last sync. The admin page now says to sync before exporting.
  • CSV formula injection: any cell that starts with =, +, -, @, a tab or a carriage return now gets a leading ', so spreadsheets open it as text. This applies to the new export and to Export Section Assignments (formerly Export Rosters), which had the problem. (The comment points to state.py:1011, but lines have shifted since. It meant export_rosters.) Export Full Attendances is JSON, so it doesn't need this.

Also

  • New Roster Management tab between General and Lab, laid out in the order staff use it. It opens with the start-of-semester steps: 1. sync the bCourses student roster, 2. import sections, 3. import section assignments. It says each step is safe to re-run, e.g. re-sync to drop students who've dropped the course. Below that are the buttons in that order (Sync bCourses Students, renamed from Sync bCourses since it only syncs students, comes first), then student search, the exports with a bullet per export giving its file type (CSV or JSON) and what it contains, the tutoring tools with their note below them, and the remove and reset tools last. General keeps the welcome message and the staff page URL.
  • Space between the tab strip and each tab's content. Only API Keys had it before.
  • Export Rosters is now Export Section Assignments, with a note that it uses the format Import Section Assignments reads, so you can export, edit and import back. The API method is still export_rosters, so API key scripts keep working.
  • Export file names name the course and term, e.g. cs61a-fa26-rosters.csv, cs61a-fa26-students.csv, cs61a-fa26-attendances.json. The course comes from its Canvas code, lowercased with anything but letters and digits dropped ("COMPSCI 61A" gives compsci61a). The term comes from the offering's start date (Jan–Apr sp, May–Jul su, Aug–Dec fa) and is left out if the offering has none. Exports from different courses and semesters no longer overwrite each other.
  • export_rosters now shares its day and time formatting with the new export (section_day_and_start). Its output hasn't changed: weekdays still use the import format's codes (M–F), and other days are blank.

Docs

The issue asks for the user docs at berkeley-cdss/docs to be updated: berkeley-cdss/docs#84, stacked on the open Sections docs PRs there.

Testing

  • tests/unit/test_student_export_search.py: export rows, Floating vs. Tutoring, offering isolation, formula neutralizing in both exports, admin- and staff-only access, and literal search wildcards.
  • tests/e2e/test_admin.py::test_admin_finds_a_students_sections: search in the browser.
  • All unit tests, e2e and a11y tests, lint, and build pass locally.

🤖 Generated with Claude Code

…CSV exports from running formulas

Admins can export a CSV of every student in the offering with their
section of each type, or "Floating" for a lab or discussion they aren't
in, and search students by name or email to see their sections.

Exported cells that start with =, +, -, @, a tab or a carriage return get
a leading apostrophe so spreadsheets open them as text, in the new export
and in Export Rosters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.82%. Comparing base (e7f4134) to head (f0f0e60).

Files with missing lines Patch % Lines
server/state.py 95.23% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #91      +/-   ##
==========================================
+ Coverage   85.41%   85.82%   +0.40%     
==========================================
  Files          31       31              
  Lines        2359     2406      +47     
==========================================
+ Hits         2015     2065      +50     
+ Misses        344      341       -3     

☔ 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-91-137456085712.us-west1.run.app

pancakereport and others added 11 commits November 12, 2026 14:54
…ters

The imports, exports, student search, and remove and reset tools move from
General to a new Roster Management tab, between General and Lab. Export
Rosters becomes Export Section Assignments, with a note that its format is
what Import Section Assignments reads, so it can be edited and imported back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
So exports from different courses don't overwrite each other in a
downloads folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
So exports from different semesters of a course don't overwrite each
other either. The term comes from the offering's start date, and is left
out when the offering has none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Students

Only API Keys had a margin above its content; the others sat against the
line under the tabs. The margin now goes on the tab strip, for every tab.

"Sync bCourses" becomes "Sync bCourses Students", since it only syncs
students.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tab opens with the setup steps (sync bCourses students, import
sections, import section assignments) and says they're safe to re-run,
with Sync bCourses Students now the first button. Then the exports and
their notes, student search, the tutoring tools with their note below
them, and the remove and reset tools last.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…names

The two export notes become one, and notes that name a button quote its
exact label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One bullet per export, in button order. "Export Full Attendances" says it
includes every student with attendance recorded, even ones removed from
a section or the offering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Eight rows instead of the browser's default two, so a message of a few
lines fits without scrolling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit also moved it below the box and added a label, which
wasn't wanted. Only the taller box stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pancakereport
pancakereport merged commit 6899da8 into main Nov 13, 2026
10 checks passed
@pancakereport
pancakereport deleted the student-export-search branch November 13, 2026 00:07
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.

CSV Export & Student Search

2 participants