Skip to content

Commit

Permalink
#119: Change attribute name usage to camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Jan 25, 2021
1 parent 28cfc72 commit 58ae900
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions datagateway_api/common/database/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def login(self, credentials):
insert_row_into_table(
SESSION,
SESSION(
ID=session_id,
USERNAME=f"{credentials['mechanism']}/root",
EXPIREDATETIME=datetime.datetime.now() + datetime.timedelta(days=1),
id=session_id,
username=f"{credentials['mechanism']}/root",
expireDateTime=datetime.datetime.now() + datetime.timedelta(days=1),
),
)
return session_id
Expand Down
40 changes: 20 additions & 20 deletions datagateway_api/common/database/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def requires_session_id(method):
def wrapper_requires_session(*args, **kwargs):
log.info(" Authenticating consumer")
session = session_manager.get_icat_db_session()
query = session.query(SESSION).filter(SESSION.ID == args[1]).first()
query = session.query(SESSION).filter(SESSION.id == args[1]).first()
if query is not None:
log.info(" Closing DB session")
session.close()
Expand Down Expand Up @@ -226,7 +226,7 @@ def get_row_by_id(table, id_):
"""
with ReadQuery(table) as read_query:
log.info(" Querying %s for record with ID: %s", table.__tablename__, id_)
where_filter = WhereFilter("ID", id_, "eq")
where_filter = WhereFilter("id", id_, "eq")
where_filter.apply_filter(read_query)
return read_query.get_single_result()

Expand Down Expand Up @@ -392,10 +392,10 @@ def __init__(self, instrument_id):
.join(FACILITY.INVESTIGATION)
.join(INVESTIGATION.INVESTIGATIONINSTRUMENT)
.join(investigation_instrument, INVESTIGATIONINSTRUMENT.INSTRUMENT)
.filter(INSTRUMENT.ID == instrument_id)
.filter(investigation_instrument.ID == INSTRUMENT.ID)
.filter(INVESTIGATION.STARTDATE >= FACILITYCYCLE.STARTDATE)
.filter(INVESTIGATION.STARTDATE <= FACILITYCYCLE.ENDDATE)
.filter(INSTRUMENT.id == instrument_id)
.filter(investigation_instrument.id == INSTRUMENT.id)
.filter(INVESTIGATION.startDate >= FACILITYCYCLE.startDate)
.filter(INVESTIGATION.startDate <= FACILITYCYCLE.endDate)
)


Expand Down Expand Up @@ -423,10 +423,10 @@ def __init__(self, instrument_id):
.join(FACILITY.INVESTIGATION)
.join(INVESTIGATION.INVESTIGATIONINSTRUMENT)
.join(investigation_instrument, INVESTIGATIONINSTRUMENT.INSTRUMENT)
.filter(INSTRUMENT.ID == instrument_id)
.filter(investigation_instrument.ID == INSTRUMENT.ID)
.filter(INVESTIGATION.STARTDATE >= FACILITYCYCLE.STARTDATE)
.filter(INVESTIGATION.STARTDATE <= FACILITYCYCLE.ENDDATE)
.filter(INSTRUMENT.id == instrument_id)
.filter(investigation_instrument.id == INSTRUMENT.id)
.filter(INVESTIGATION.startDate >= FACILITYCYCLE.startDate)
.filter(INVESTIGATION.startDate <= FACILITYCYCLE.endDate)
)


Expand Down Expand Up @@ -456,11 +456,11 @@ def __init__(self, instrument_id, facility_cycle_id):
.join(FACILITY.INSTRUMENT)
.join(INVESTIGATION.INVESTIGATIONINSTRUMENT)
.join(investigation_instrument, INVESTIGATIONINSTRUMENT.INSTRUMENT)
.filter(INSTRUMENT.ID == instrument_id)
.filter(FACILITYCYCLE.ID == facility_cycle_id)
.filter(investigation_instrument.ID == INSTRUMENT.ID)
.filter(INVESTIGATION.STARTDATE >= FACILITYCYCLE.STARTDATE)
.filter(INVESTIGATION.STARTDATE <= FACILITYCYCLE.ENDDATE)
.filter(INSTRUMENT.id == instrument_id)
.filter(FACILITYCYCLE.id == facility_cycle_id)
.filter(investigation_instrument.id == INSTRUMENT.id)
.filter(INVESTIGATION.startDate >= FACILITYCYCLE.startDate)
.filter(INVESTIGATION.startDate <= FACILITYCYCLE.endDate)
)


Expand Down Expand Up @@ -493,11 +493,11 @@ def __init__(self, instrument_id, facility_cycle_id):
.join(FACILITY.INSTRUMENT)
.join(INVESTIGATION.INVESTIGATIONINSTRUMENT)
.join(investigation_instrument, INVESTIGATIONINSTRUMENT.INSTRUMENT)
.filter(INSTRUMENT.ID == instrument_id)
.filter(FACILITYCYCLE.ID == facility_cycle_id)
.filter(investigation_instrument.ID == INSTRUMENT.ID)
.filter(INVESTIGATION.STARTDATE >= FACILITYCYCLE.STARTDATE)
.filter(INVESTIGATION.STARTDATE <= FACILITYCYCLE.ENDDATE)
.filter(INSTRUMENT.id == instrument_id)
.filter(FACILITYCYCLE.id == facility_cycle_id)
.filter(investigation_instrument.id == INSTRUMENT.id)
.filter(INVESTIGATION.startDate >= FACILITYCYCLE.startDate)
.filter(INVESTIGATION.startDate <= FACILITYCYCLE.endDate)
)


Expand Down

0 comments on commit 58ae900

Please sign in to comment.