Refine
This commit is contained in:
@@ -35,21 +35,21 @@ def get_pipe(name: str, id: str) -> dict[str, Any]:
|
|||||||
|
|
||||||
# DingZQ, 2025-03-29
|
# DingZQ, 2025-03-29
|
||||||
def get_all_pipes(name: str) -> list[dict[str, Any]]:
|
def get_all_pipes(name: str) -> list[dict[str, Any]]:
|
||||||
p = try_read(name, f"select * from pipes")
|
rows = read_all(name, f"select * from pipes")
|
||||||
if p == None:
|
if rows == None:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for p in p:
|
for row in rows:
|
||||||
d = {}
|
d = {}
|
||||||
d['id'] = str(p['id'])
|
d['id'] = str(row['id'])
|
||||||
d['node1'] = str(p['node1'])
|
d['node1'] = str(row['node1'])
|
||||||
d['node2'] = str(p['node2'])
|
d['node2'] = str(row['node2'])
|
||||||
d['length'] = float(p['length'])
|
d['length'] = float(row['length'])
|
||||||
d['diameter'] = float(p['diameter'])
|
d['diameter'] = float(row['diameter'])
|
||||||
d['roughness'] = float(p['roughness'])
|
d['roughness'] = float(row['roughness'])
|
||||||
d['minor_loss'] = float(p['minor_loss'])
|
d['minor_loss'] = float(row['minor_loss'])
|
||||||
d['status'] = str(p['status'])
|
d['status'] = str(row['status'])
|
||||||
result.append(d)
|
result.append(d)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user