Filter observations in mysql queries

parent fa7398ca
Pipeline #42762350 passed with stages
in 5 minutes and 20 seconds
...@@ -189,21 +189,15 @@ class ObservationListView(ListView): ...@@ -189,21 +189,15 @@ class ObservationListView(ListView):
if not failed: if not failed:
observations = observations.exclude(vetted_status='failed') observations = observations.exclude(vetted_status='failed')
if not unvetted: if not unvetted:
observations = observations.exclude(vetted_status='unknown', observations = observations.exclude(vetted_status='unknown', end__lte=datetime.now())
id__in=(o.id for
o in observations if o.is_past))
if not future: if not future:
observations = observations.exclude(id__in=(o.id for observations = observations.exclude(vetted_status='unknown', end__gt=datetime.now())
o in observations if o.is_future))
if not waterfall: if not waterfall:
observations = observations.filter(id__in=(o.id for observations = observations.exclude(waterfall='')
o in observations if o.has_waterfall))
if not audio: if not audio:
observations = observations.filter(id__in=(o.id for observations = observations.exclude(archived=False, payload='')
o in observations if o.has_audio))
if not data: if not data:
observations = observations.filter(id__in=(o.id for observations = observations.exclude(demoddata__payload_demod__isnull=True)
o in observations if o.has_demoddata))
return observations return observations
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment