Skip to content

Summer 2026 courses display as "unknown semester" when syncing from bcourses#446

Merged
cycomachead merged 1 commit into
mainfrom
cycomachead/134-fix-unknown-semester-display/2
Jun 21, 2026
Merged

Summer 2026 courses display as "unknown semester" when syncing from bcourses#446
cycomachead merged 1 commit into
mainfrom
cycomachead/134-fix-unknown-semester-display/2

Conversation

@cycomachead

Copy link
Copy Markdown
Contributor

General Info

Changes

Fixes Summer 2026 (and similar) courses displaying as "Unknown Semester" when syncing from bCourses. The root cause was that bCourses sometimes leaves the Canvas term name blank, causing course.semester to be stored as nil.

Added Course.semester_from_term(term, created_at) which walks a fallback chain to derive a semester string:

  1. Term name — used as-is when present (existing behavior for named terms like "Spring 2026")
  2. Term start date — maps the start month to Berkeley's academic seasons (Jan–Apr → Spring, May–Jul → Summer, Aug–Dec → Fall) when the name is blank
  3. Course created_at — used when there is no term or no term start date (e.g., courses with start_at: null and no named term)

Updated all call sites to use this logic: Course.find_or_create_course, the CoursesController semester list and filter, and the backfill_course_semester rake task.

Also added config/brakeman.ignore to suppress the Rails 7.2 EOL warning until the Rails 8.x upgrade is complete.

Testing

  • Added 11 unit specs for Course.semester_from_term covering: name preferred over dates, derivation for each season, nil/blank/unparseable inputs, created_at fallback, and priority ordering.
  • Added find_or_create_course specs for blank-named terms (Summer start date) and the no-term/no-start-date case (using created_at → Spring 2026, matching the real payload from the ticket).
  • Added controller specs verifying that derived semesters appear in @semesters and that filtering by a derived semester works correctly.
  • All 65 examples pass; RuboCop and Brakeman are clean.

Documentation

No documentation changes required.

Checklist

  • Name of branch corresponds to story

Superconductor Ticket Implementation | App Preview | Guided Review

bCourses sometimes leaves the term name blank (e.g., Summer 2026),
causing courses to display as "Unknown Semester". We now derive the
semester string by mapping the term's start date, or the course's
creation date, to Berkeley's academic seasons.

- Added `Course.semester_from_term` to handle the fallback logic
- Updated controllers and backfill tasks to use derived semesters
- Added `config/brakeman.ignore` for the Rails EOL warning
- Included comprehensive tests for date-based semester derivation

Co-authored-by: Claude Code <noreply@anthropic.com>
@cycomachead cycomachead merged commit 604d200 into main Jun 21, 2026
11 checks passed
@cycomachead cycomachead deleted the cycomachead/134-fix-unknown-semester-display/2 branch June 21, 2026 09:38
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.

1 participant