Skip to content

Commit

Permalink
TEMP: using ts_server timestamps for query (#185)
Browse files Browse the repository at this point in the history
* updated for deploy

* change deploy

* logs

* log sql

* log sql

* updated to use ts servers

* fixed power ts
  • Loading branch information
aaron-wu1 authored Feb 25, 2024
1 parent e8d589d commit 619aaf1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion backend/api/database/models/power_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)

Expand Down
13 changes: 4 additions & 9 deletions backend/api/database/models/teros_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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))

Expand Down

0 comments on commit 619aaf1

Please sign in to comment.