learning-unlimited/ESP-Website — comment on commit 2295173fe9e1d569667ee24c7440b72a989387de
File: esp/esp/program/models/class_.py line 970
By aseering:

Hm... There must be a better way...

Aha! Take a look at .exists() (same link as for count() above). I think the following would be cleaner, but otherwise functionally equivalent:

```
if not meeting_times.exists():
return False
```

As for the ordering, I kinda feel like requiring ordering by a particular field but not checking this, is in some sense worse than not checking at all; it's a less-likely but harder-to-catch failure mode. I'd rather risk using Django's private API (meaning we might have to fix it in a future release, but probably not as I think this particular bit of code is relatively stable). It looks like the following would work:

```
assert meeting_times.query.order_by and meeting_times.query.order_by[0] == 'start'
```