People often ask me what the heck is going on with Cal Poly’s nutty quarter numbering system. I’m going to try to summarize it.
Before I begin, I think I’m probably suffering from Stockholm syndrome, here; I’m kind of fond of it, even though it’s non-intuitive.
Based on a very brief conversation with Debbie Dudley, it appears that the current system was designed in 2006, during the migration to PeopleSoft. At that time, Cal Poly had to devise a system for numbering quarters both in the future and in the past (that is, the new system also had to represent existing records of past students).
The rest of this is still largely hypothetical; please feel free to write and correct me about anything I’ve gotten wrong; I think that trying to understand how the system arose helps me (and you?) to understand its quirks a bit better.
(Semi) Hypothetical History
Problem: we need a way to represent a particular quarter (e.g.: Fall 2006) as a number. It would be really convenient to be able to sort in a sane way, etc. etc.
Solution: well, let’s use integers, not floats (for what are hopefully obvious reasons). Let’s use the year, then a digit for the quarter. What digits should we use for the quarters? Well, we should probably stay away from zero, because it’s not clear what year a zero would belong to. Okay, let’s use 2, 4, 6, and 8 for the four quarters. This spaces out the four quarters, and allows for the insertion of additional terms, should it become necessary.
So, how should we write Fall 2006? We could write “20068”. But… let’s try to cut that down to four digits.
(Knowing what I now know, I can’t see why you would want to do this unless PeopleSoft has some kind of internal restriction or performance penalty regarding numbers with more digits. Let’s assume this is the case.)
Well, maybe we can encode the century as a single digit. Let’s use “2” for the century from 2000 — 2099. So Fall 2006 becomes 2068.
Great! So how do we represent Spring 1997?
If we’re using century codes, then the one before “2” should be “1”. So in this case, Winter 1997 would be written as 1972.
Apparently, though, we decided that this was confusing, and that we should instead use a “0” for the 1900s, so that Winter 1997 is instead written as 0972.
This scheme is not awful, but it does have some problems if you try to subtract numbers or increment or decrement quarter numbers, because going from a fall quarter to the next winter quarter requires adding four… unless the year is 1999, in which case you have to add 1004. Oh well.
Okay, so let’s summarize. How the heck do we actually read one of these numbers?
Examples of quarter numbers:
2174 : 2000 + 17 = 2017, 4 = Spring. Spring 2017.
2102 : 2000 + 10 = 2010, 2 = Winter. Winter 2010.
976 : 1900 + 97 = 1997, 6 = Summer. Summer 1997.
Parsing a Cal Poly (San Luis Obispo) quarter number:
Actually, I’m going to be precise, and just give you some code.
Yes, in Racket.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#lang typed/racket ;; given a quarter, return its season: "Fall", "Winter", etc. (define (qtr->season [qtr : Natural]) : Season (match (modulo qtr 10) [2 "Winter"] [4 "Spring"] [6 "Summer"] [8 "Fall"])) ;; return the year in which a quarter number falls (define (qtr->year [qtr : Natural]) : Natural (define century-code (floor (/ qtr 1000))) (define year-code (modulo (floor (/ qtr 10)) 100)) (define century-offset (match century-code [0 1900] [2 2000] [_ (raise-argument-error 'qtr-year "qtr with century code of 0 or 2" 0 qtr)])) (+ century-offset year-code))