Skip to content

Commit

Permalink
#34: Refactor and allow filters
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Aug 29, 2019
1 parent fc9ce04 commit 013adbf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions common/database_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,17 @@ def _get_investigations_for_instrument(instrument_id):
return investigations


def get_facility_cycles_for_instrument(instrument_id, filters):
"""
Given an instrument_id get facility cycles where the instrument has investigations that occur within that cycle
:param instrument_id: The id of the instrument
:return: A list of facility cycle entities
"""
query = InstrumentFacilityCyclesQuery(instrument_id)
filter_handler = FilterOrderHandler()
filter_handler.add_filter(query.start_date_filter)
filter_handler.add_filter(query.end_date_filter)
return get_filtered_read_query_results(filter_handler, filters, query)


def get_facility_cycles_for_instrument_count(instrument_id):
Expand Down

0 comments on commit 013adbf

Please sign in to comment.