Skip to content

Commit b86283d

Browse files
committed
feat: hacky way to limit location query to 10000 measurements
1 parent 48a4487 commit b86283d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

rest_api/src/handlers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@ def fetch_locations_for_device_list(conn, device_list: list[str]) -> list:
175175
ON m.registry_id = r.id
176176
JOIN sensors s
177177
ON m.sensor_id = s.id
178-
ORDER BY m.timestamp DESC LIMIT 50
178+
ORDER BY m.timestamp DESC LIMIT 10000
179179
"""
180+
# TODO: Remove the hacky way to limit query size
180181
cur.execute(
181182
query,
182183
)
@@ -224,7 +225,9 @@ def fetch_locations_for_device_list(conn, device_list: list[str]) -> list:
224225
filtered_data = {k: v for k, v in data.items() if v is not None}
225226

226227
# sensor_name = sensor_names[ids.index(row[0])]
227-
filtered_data["sensor_name"] = sensor_name
228+
filtered_data["sensor_name"] = sensor_names[
229+
0
230+
] # Sensor names are the same for all ids
228231
# print(f"Sensor name: {sensor_name}")
229232
if filtered_data:
230233
if (

0 commit comments

Comments
 (0)