Skip to content

Commit

Permalink
#34: Change how filters are set
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Sep 10, 2019
1 parent cd95508 commit 6bbabda
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions common/database_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,16 +485,9 @@ def _get_start_and_end_date_filters(self, instrument_id):
:param instrument_id: the id of the instrument
:return:
"""
investigations = self._get_investigations_for_instrument(instrument_id)
start_date = datetime.datetime(3000, 1, 1)
end_date = datetime.datetime(1, 1, 1)
for investigation in investigations:
if investigation.STARTDATE < start_date:
start_date = investigation.STARTDATE
if investigation.ENDDATE > end_date:
end_date = investigation.ENDDATE
self.start_date_filter = WhereFilter("STARTDATE", start_date, "gte")
self.end_date_filter = WhereFilter("STARTDATE", end_date, "lte")
def set_filters(self, filters):
for query_filter in filters:
self.filters.append(QueryFilterFactory.get_query_filter(query_filter))

def _get_investigations_for_instrument(self):
"""
Expand Down

0 comments on commit 6bbabda

Please sign in to comment.