Fixed node properties

This commit is contained in:
DingZQ
2025-03-29 17:24:49 +08:00
parent f795ca29f1
commit 90eb873ecf
4 changed files with 20 additions and 14 deletions

View File

@@ -33,11 +33,13 @@ def get_all_junctions(name: str) -> list[dict[str, Any]]:
result = []
for row in rows:
d = {}
d['id'] = str(row['id'])
d['x'] = float(row['x'])
d['y'] = float(row['y'])
id = str(row['id'])
xy = get_node_coord(name, id)
d['id'] = id
d['x'] = float(xy['x'])
d['y'] = float(xy['y'])
d['elevation'] = float(row['elevation'])
d['links'] = get_node_links(name, row['id'])
d['links'] = get_node_links(name, id)
result.append(d)
return result

View File

@@ -35,12 +35,14 @@ def get_all_reservoirs(name: str) -> list[dict[str, Any]]:
result = []
for row in rows:
d = {}
d['id'] = str(row['id'])
d['x'] = float(row['x'])
d['y'] = float(row['y'])
id = str(row['id'])
xy = get_node_coord(name, id)
d['id'] = id
d['x'] = float(xy['x'])
d['y'] = float(xy['y'])
d['head'] = float(row['head']) if row['head'] != None else None
d['pattern'] = str(row['pattern']) if row['pattern'] != None else None
d['links'] = get_node_links(name, row['id'])
d['links'] = get_node_links(name, id)
result.append(d)
return result

View File

@@ -51,9 +51,11 @@ def get_all_tanks(name: str) -> list[dict[str, Any]]:
result = []
for row in rows:
d = {}
d['id'] = str(row['id'])
d['x'] = float(row['x'])
d['y'] = float(row['y'])
id = str(row['id'])
xy = get_node_coord(name, id)
d['id'] = id
d['x'] = float(xy['x'])
d['y'] = float(xy['y'])
d['elevation'] = float(row['elevation'])
d['init_level'] = float(row['init_level'])
d['min_level'] = float(row['min_level'])
@@ -62,7 +64,7 @@ def get_all_tanks(name: str) -> list[dict[str, Any]]:
d['min_vol'] = float(row['min_vol'])
d['vol_curve'] = str(row['vol_curve']) if row['vol_curve'] != None else None
d['overflow'] = str(row['overflow']) if row['overflow'] != None else None
d['links'] = get_node_links(name, row['id'])
d['links'] = get_node_links(name, id)
result.append(d)
return result

View File

@@ -40,8 +40,8 @@ def get_all_pumps(name: str) -> list[dict[str, Any]]:
d['node2'] = str(row['node2'])
d['power'] = float(row['power']) if row['power'] != None else None
d['head'] = str(row['head']) if row['head'] != None else None
d['speed'] = float(p['speed']) if p['speed'] != None else None
d['pattern'] = str(p['pattern']) if p['pattern'] != None else None
d['speed'] = float(row['speed']) if row['speed'] != None else None
d['pattern'] = str(row['pattern']) if row['pattern'] != None else None
result.append(d)
return result