Fixes .students() for twophase to not be really slow.

Also fixes the lottery to use the new one.  The changes in 3e8b12ec
resulted in some incredibly slow queries, so we do the logic in python
instead.  Warning: comm panel queries of the form "students who have a
star or marked a choice in twophase" will probably be very slow.