完成在线数据属性获取方法
This commit is contained in:
@@ -566,22 +566,21 @@ class RealtimeRepository:
|
||||
raise ValueError(f"Invalid type: {type}. Must be 'node' or 'link'")
|
||||
|
||||
# Format the results
|
||||
results = [{"ID": item["id"], "value": item["value"]} for item in data]
|
||||
return {"results": results}
|
||||
return [{"ID": item["id"], "value": item["value"]} for item in data]
|
||||
|
||||
@staticmethod
|
||||
async def query_simulation_result_by_ID_time(
|
||||
async def query_simulation_result_by_id_time(
|
||||
conn: AsyncConnection,
|
||||
ID: str,
|
||||
id: str,
|
||||
type: str,
|
||||
query_time: str,
|
||||
) -> list[dict]:
|
||||
"""
|
||||
Query simulation results by ID and time from TimescaleDB.
|
||||
Query simulation results by id and time from TimescaleDB.
|
||||
|
||||
Args:
|
||||
conn: Database connection
|
||||
ID: The ID of the node or link
|
||||
id: The id of the node or link
|
||||
type: Type of data ("node" or "link")
|
||||
query_time: Time to query (ISO format string)
|
||||
|
||||
@@ -611,11 +610,11 @@ class RealtimeRepository:
|
||||
# Query based on type
|
||||
if type.lower() == "node":
|
||||
return await RealtimeRepository.get_node_by_time_range(
|
||||
conn, start_time, end_time, ID
|
||||
conn, start_time, end_time, id
|
||||
)
|
||||
elif type.lower() == "link":
|
||||
return await RealtimeRepository.get_link_by_time_range(
|
||||
conn, start_time, end_time, ID
|
||||
conn, start_time, end_time, id
|
||||
)
|
||||
else:
|
||||
raise ValueError(f"Invalid type: {type}. Must be 'node' or 'link'")
|
||||
|
||||
Reference in New Issue
Block a user