fedora-infra/fas — pull request #20 by CodeBlock (2013-05-04 03:49:52+00:00)
Title: More optimizations for group view.

In the `view()` method, we were hitting the database with a really expensive
query for large groups (such as cla_fpca), converting it to a list (so storing
it in memory), then only rendering the results if the list contained less than
10 elements.

This is a semi-rare case where it makes sense to do a `count()` query first,
then act on the results if the result of the count query is < 10.

For consistency, we keep the conditional in the template, but pass the template
object a query object, rather than a list. We only convert to a list (which is
what performs the actual query) if the conditional passes. The conditional is
what issues the count query.