SEL-Columbia/formhub — pull request #1322 by dpapathanasiou (2014-04-23 18:49:33+00:00)
Title: Improve export

Made some improvements to how the export logic checks the relational db/django ORM:

* Used Q objects to create an "OR" query rather than a sql subquery, which is expensive

* Instead of querying the export table *twice*, first to take a count, then to determine if the latest export timestamp is earlier than the latest XForm submission, just call the latter function instead

This logic flow is still very ugly: the exports_outdated() function really should *not* be a classmethod of Export, but doing it incrementally like this for now, until can do a more thorough overhaul later.
+ like this for now, until can do a more thorough overhaul later.