diff --git a/backend/api/database/models/power_data.py b/backend/api/database/models/power_data.py index 46a88ae6..53304ef3 100644 --- a/backend/api/database/models/power_data.py +++ b/backend/api/database/models/power_data.py @@ -86,7 +86,7 @@ def get_power_data_obj( PowerData.current.label("current"), ) .where(PowerData.cell_id == cell_id) - .filter((PowerData.ts.between(start_time, end_time))) + .filter((PowerData.ts_server.between(start_time, end_time))) .subquery() ) diff --git a/backend/api/database/models/teros_data.py b/backend/api/database/models/teros_data.py index 7db1f6f2..03058135 100644 --- a/backend/api/database/models/teros_data.py +++ b/backend/api/database/models/teros_data.py @@ -71,12 +71,7 @@ def get_teros_data_obj( stream=False, ): """gets teros data as a list of objects""" - data = { - "timestamp": [], - "vwc": [], - "temp": [], - "ec": [] - } + data = {"timestamp": [], "vwc": [], "temp": [], "ec": []} # VWC stored in decimal, converted to percentage stmt = ( @@ -87,10 +82,10 @@ def get_teros_data_obj( TEROSData.ec.label("ec"), ) .where(TEROSData.cell_id == cell_id) - .filter((TEROSData.ts.between(start_time, end_time))) - .order_by(TEROSData.ts) + .filter((TEROSData.ts_server.between(start_time, end_time))) + .order_by(TEROSData.ts_server) ) - + utc_tz = timezone.utc la_tz = timezone(timedelta(hours=0))