Skip to content

Commit

Permalink
#111: Match style guides
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Oct 31, 2019
1 parent ce639cf commit 5721181
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions common/database_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def _set_filter_fields(self):
self.included_field = self.field.split(".")[1]
self.field = self.field.split(".")[0]


def apply_filter(self, query):
try:
field = getattr(query.table, self.field)
Expand Down Expand Up @@ -554,15 +553,15 @@ def get_investigations_for_user_count(user_id, filters):
class InstrumentFacilityCyclesQuery(ReadQuery):
def __init__(self, instrument_id):
super().__init__(FACILITYCYCLE)
investigationInstrument = aliased(INSTRUMENT)
investigation_instrument = aliased(INSTRUMENT)
self.base_query = self.base_query \
.join(FACILITYCYCLE.FACILITY) \
.join(FACILITY.INSTRUMENT) \
.join(FACILITY.INVESTIGATION) \
.join(INVESTIGATION.INVESTIGATIONINSTRUMENT) \
.join(investigationInstrument, INVESTIGATIONINSTRUMENT.INSTRUMENT) \
.join(investigation_instrument, INVESTIGATIONINSTRUMENT.INSTRUMENT) \
.filter(INSTRUMENT.ID == instrument_id) \
.filter(investigationInstrument.ID == INSTRUMENT.ID) \
.filter(investigation_instrument.ID == INSTRUMENT.ID) \
.filter(INVESTIGATION.STARTDATE >= FACILITYCYCLE.STARTDATE) \
.filter(INVESTIGATION.STARTDATE <= FACILITYCYCLE.ENDDATE)

Expand Down Expand Up @@ -593,16 +592,16 @@ def get_facility_cycles_for_instrument_count(instrument_id, filters):
class InstrumentFacilityCycleInvestigationsQuery(ReadQuery):
def __init__(self, instrument_id, facility_cycle_id):
super().__init__(INVESTIGATION)
investigationInstrument = aliased(INSTRUMENT)
investigation_instrument = aliased(INSTRUMENT)
self.base_query = self.base_query \
.join(INVESTIGATION.FACILITY) \
.join(FACILITY.FACILITYCYCLE) \
.join(FACILITY.INSTRUMENT) \
.join(INVESTIGATION.INVESTIGATIONINSTRUMENT) \
.join(investigationInstrument, INVESTIGATIONINSTRUMENT.INSTRUMENT) \
.join(investigation_instrument, INVESTIGATIONINSTRUMENT.INSTRUMENT) \
.filter(INSTRUMENT.ID == instrument_id) \
.filter(FACILITYCYCLE.ID == facility_cycle_id) \
.filter(investigationInstrument.ID == INSTRUMENT.ID) \
.filter(investigation_instrument.ID == INSTRUMENT.ID) \
.filter(INVESTIGATION.STARTDATE >= FACILITYCYCLE.STARTDATE) \
.filter(INVESTIGATION.STARTDATE <= FACILITYCYCLE.ENDDATE)

Expand Down

0 comments on commit 5721181

Please sign in to comment.