fix current/past/future course list

test plan:
 on /courses (the "view all courses" link in the menu)
 1. ensure hard-concluded and soft-concluded courses show up
    in the "Past Enrollments" section
 2. ensure rejected enrollments show up in the "Past Enrollments"
    section
 3. ensure courses with no dates, or with a current date range
    (either from the term, or from the course settings with
    "restrict enrollment to these dates" checked) show up
    in "My Courses", regardless of course published status
    or acceptance of invitation
 4. ensure courses whose start date is in the future (whether
    via course settings or enrollment term) show up under
    "Future Enrollments", regardless of published status of the course
    (again, course settings only apply if the restrict-dates
    setting is checked)
   * Yes, students should see the names of unpublished courses
     they are enrolled in, but the links should not be clickable.
     This is the major complaint of the ticket; we want to
     forestall "Dude, where's my course?" support questions.
 5. ensure "Future Enrollments" is empty when the viewer is a student
    or observer and the account settings checks "Restrict students
    from viewing courses before start date"
 6. ensure all three lists are sorted by course name
    with invitations before active courses
    (previously only the current list was sorted; the others were
    in arbitrary database order)

fixes CNVS-13583

Change-Id: I49d36dd32dc04ea507d0a379a2e3491a837fd160
Reviewed-on: https://gerrit.instructure.com/37294
QA-Review: Clare Strong <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>