fix: missing fall 2026 term in schedule dropdown#503
Merged
Conversation
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.
Fixes #502
Root cause
The
seasonenum stores non-chronological values (spring: 1, fall: 2, summer: 3), andTerm.current_and_futurecompared seasons by raw enum value:During a summer term (season value 3), fall of the same year (season value 2) fails the
>= 3check — so the Fall option disappears from the schedule dropdown every summer. The same raw values were used inorder(season: ...)calls, sorting Fall before Summer within a year across the app.Changes
Term::SEASON_CHRONOLOGICAL_POSITIONSand aseason_position_sqlCASE expression that maps stored enum values to chronological order (spring → summer → fall). No data migration needed.chronological/reverse_chronologicalscopes; replaced all raworder(year:, season:)usages (term scopes, admin terms/course catalog/finals schedules/rooms).current_and_futurenow compares by chronological position, so Fall 2026 shows during Summer 2026.Term.enrolled_for(user)scope), and the selected term is resolved from that list rather than anyterm_uidparam.flowchart LR A[Term.enrolled_for user] --> B[current_and_future] B -->|empty| C[last 6 enrolled terms] B -->|present| D[term dropdown] C --> DTests
Model specs for the chronological scopes,
current_and_futurein both summer and fall,enrolled_for, andseason_position. Full suite passes locally.