learning-unlimited/ESP-Website — pull request #1045 by benjaminjkraft (2014-02-17 00:35:52+00:00)
Title: Various fixes to lottery script

Apparently I never made a pull request for this, so here it is. Whoops!

* Sections will now be filled from longest to shortest (which was
previously the case according to a comment but not in reality), and
rerandomized for each priority level.
* The code that imports preferences will not import any preferences
corresponding to non-accepted sections. If it somehow otherwise
imports preferences for sections it doesn't know about, it will error.
* The code deals more carefully with which things should apply to all
priority levels (including possibly the one for grade range
exceptions), and which things should be done only on "real" priority
levels.
* The error message when classes are full is now correct.
* The try/except for importing preferences is now an actual
QuerySet.exists() check.
* A test was added for running the lottery with multiple priority
levels.