fixed epoch bug

This commit is contained in:
grove5_admin committed 2026-04-29 23:47:41 -07:00
1 parent 05e5c94176
commit 3f9ebc36bd
1 file changed
+4 -4
+4 -4
View File
@@ -430,7 +430,7 @@ async def get_environment_history(
db: aiosqlite.Connection, db: aiosqlite.Connection,
chamber_id: str, chamber_id: str,
since: int, # unix ts since: int, # unix ts
limit: int = 288, # 24h at 5min intervals limit: int = 2880, # 24h at 30s intervals (dev); 288 at 5min (production)
) -> list[dict]: ) -> list[dict]:
""" """
Return environment readings for a chamber since a given timestamp. Return environment readings for a chamber since a given timestamp.
@@ -439,7 +439,7 @@ async def get_environment_history(
async with db.execute( async with db.execute(
""" """
SELECT SELECT
collected_at AS ts, received_at AS ts,
temp_c, temp_c,
humidity_pct AS rh_pct, humidity_pct AS rh_pct,
co2_ppm, co2_ppm,
@@ -451,8 +451,8 @@ async def get_environment_history(
pressure_hpa, pressure_hpa,
baseline_established baseline_established
FROM payloads FROM payloads
WHERE chamber_id = ? AND collected_at >= ? AND ambient_valid = 1 WHERE chamber_id = ? AND received_at >= ? AND ambient_valid = 1
ORDER BY collected_at ASC ORDER BY received_at ASC
LIMIT ? LIMIT ?
""", """,
(chamber_id, since, limit), (chamber_id, since, limit),