model: add missing indexes

They both speed up some long-running queries.
model.flight: speed up elevations query

Remove 'elevations != None' check in SQL query but check it in the
following flat loop. That saves 1/4 to 1/3 of the SQL running time.

Using a CTE instead of a subquery is a more explicit way to tell the
postgres planner that this part of the query is constant.
notifications/timeline: fix privacy_level filter
flightpath: check for output length before adding elevations

This should fix #288