Fix cur_grade to be relative to the relevant program's start date

This should fix #1216. Also includes some other cleanup around grade and schoolyear logic.
Can this function have a docstring?  Its behavior is definitely not obvious.