Compare commits

..

7 Commits

Author SHA1 Message Date
hasslesstech 21f2428a7c [P] Improve marker removal architecture to allow for future extensions
Component testing / Hub testing (push) Successful in 22s
Component testing / Integration smoke testing (push) Has been cancelled
Component testing / Store testing (push) Has been cancelled
2026-03-26 21:11:02 +02:00
Rhinemann 809d3bedf9 [P] Add touch handling (untested). 2026-03-26 18:58:59 +02:00
Rhinemann 694345e705 Correct pothole deletion function 2026-03-26 18:58:59 +02:00
Rhinemann 825ce5cb5c Use lat lon validation 2026-03-26 18:58:59 +02:00
Rhinemann 1fe7e3018f Add lat lon to pothole mapper 2026-03-26 18:58:59 +02:00
Rhinemann 6e84ae35c2 Add type hints 2026-03-26 18:58:59 +02:00
Rhinemann 254e6c8cd2 [P] Add bump remove function 2026-03-26 18:58:59 +02:00
+3 -14
View File
@@ -48,9 +48,7 @@ async def websocket_endpoint(websocket: WebSocket, user_id: int):
try:
# send already available data
r = processed_agent_data.select().order_by(processed_agent_data.c.timestamp)
session = SessionLocal()
stored_data = session.execute(r).fetchall()
session.close()
stored_data = SessionLocal().execute(r).fetchall()
jsonable_data = [{c.name: getattr(i, c.name) for c in processed_agent_data.columns} for i in stored_data]
for i in jsonable_data:
@@ -200,12 +198,8 @@ def update_processed_agent_data(processed_agent_data_id: int, data: ProcessedAge
session.commit()
updated_result = session.execute(query).fetchone()
return ProcessedAgentDataInDB(**updated_result._mapping)
except Exception as err:
session.rollback()
print(f"Database error: {err}")
raise HTTPException(status_code=500, detail="Internal Server Error")
finally:
session.close()
@@ -236,12 +230,7 @@ def delete_processed_agent_data(processed_agent_data_id: int):
session.commit()
return ProcessedAgentDataInDB(**result._mapping)
except Exception as err:
session.rollback()
print(f"Database error: {err}")
raise HTTPException(status_code=500, detail="Internal Server Error")
finally:
session.close()