Improve Semester Display on Dashboard: Group Courses, Add Semester Headers, and Implement Sorting Logic#383
Merged
cycomachead merged 7 commits intomainfrom Apr 14, 2026
Conversation
Implement logic to group courses by semester on the dashboard, replacing the flat list with a categorized view. This includes a custom sorting algorithm to display semesters in reverse chronological order (Fall > Summer > Spring > Winter). - Added `Course.sort_semesters` utility for season-aware chronological sorting - Updated `CoursesController` to group teacher and student courses - Added full-width semester header rows to the dashboard tables - Removed redundant "Term" column in favor of group headers - Added unit and controller specs for sorting and grouping logic Co-authored-by: Claude Code <noreply@anthropic.com>
cycomachead
commented
Apr 14, 2026
Contributor
Author
cycomachead
left a comment
There was a problem hiding this comment.
Sigh, lots of weird front end asset stuff is broken.
| # Within the same year: Fall > Summer > Spring > Winter (furthest out to most recent). | ||
| SEMESTER_SEASON_ORDER = { 'Fall' => 3, 'Summer' => 2, 'Spring' => 1, 'Winter' => 0 }.freeze | ||
|
|
||
| # Returns a numeric sort key for a semester string (e.g. "Spring 2026"). |
Contributor
Author
There was a problem hiding this comment.
We should at some point consider validating the data, or using some kind of a current term.
|
|
||
| parts = semester.split | ||
| season = parts[0] | ||
| year = parts[1].to_i |
Contributor
Author
There was a problem hiding this comment.
Luckily in ruby this is safe. 🙃
I did have to check, but this is why ruby is great.
irb(main):001> 'hello'.to_i
=> 0
irb(main):002> 'hello'.split
=> ["hello"]
irb(main):003> 'hello'.split[1]
=> nil
irb(main):004> 'hello'.split[1].to_i
=> 0
irb(main):005>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New Dashboard look:

this may be too bold, but thinking about what the Berkeley color palette is like.
I've migrated all production courses to have the correct semester, but there is still a fallback.
Changes
Improves the dashboard course listing by grouping courses into semester sections with header rows, replacing the previous flat list. Semesters are sorted most-recent-first, with within-year ordering of Fall > Summer > Spring > Winter.
Key changes:
Coursemodel: AddedSEMESTER_SEASON_ORDERconstant,semester_sort_key, andsort_semestersclass methods for reusable, season-aware chronological sortingCoursesController: Addedgroup_by_semesterhelper;indexnow produces@teacher_courses_by_semesterand@student_courses_by_semester(arrays of[semester_name, [user_to_courses]]pairs) alongside the existing flat lists used for empty-state checkstable-secondary fw-boldheader row per semester group. Removed the oldcreated_at-based term calculation and the now-redundant "Term" column from the student tablefilter_by_semestermethod from the controllerTesting
Course.semester_sort_keyunit specs covering all four seasons, nil, and blank inputsCourse.sort_semestersspecs covering multi-year sorting, all-four-seasons-in-one-year ordering, nil placement, single item, and empty arrayDocumentation
No additional documentation required.
Checklist
Superconductor Ticket Implementation | App Preview | Guided Review