missing dists, sensors attributs nur schreiben wenn wirklich etwas fehlt.
This commit is contained in:
+7
-3
@@ -810,20 +810,24 @@ def check_file_in_work(work_dir: Path, filename: Path) -> tuple[Path, bool]:
|
||||
|
||||
def check_existance(res_mappings: dict, res_dist: dict, res_pos: dict, res_tunnel: dict) -> dict:
|
||||
ret = dict()
|
||||
ret["missing_distributors"] = list()
|
||||
ret["missing_sensors"] = list()
|
||||
ret["missing_tunnel"] = list()
|
||||
|
||||
for dname in res_mappings.keys():
|
||||
if dname not in res_dist:
|
||||
if "missing_distributors" not in ret:
|
||||
ret["missing_distributors"] = list()
|
||||
ret["missing_distributors"].append(dname)
|
||||
for sname, lofsensors in res_mappings.items():
|
||||
for s in lofsensors:
|
||||
if s not in res_pos:
|
||||
if "missing_sensors" not in ret:
|
||||
ret["missing_sensors"] = list()
|
||||
ret['missing_sensors'].append(s)
|
||||
for tname in res_tunnel.keys():
|
||||
if tname == "length": # dict enthält auch die Länge aller Tunnels in einem Key
|
||||
continue
|
||||
if len(res_tunnel[tname]) < 2 :
|
||||
if "missing_tunnel" not in ret:
|
||||
ret["missing_tunnel"] = list()
|
||||
ret["missing_tunnel"].append(tname)
|
||||
if len(res_tunnel[tname]) > 2 :
|
||||
if "overdefined_tunnel" not in ret:
|
||||
|
||||
+10
-3
@@ -150,9 +150,16 @@ def prepare_data(rawdata:dict):
|
||||
dtunlength = rawdata["tunnels"]["length"]
|
||||
|
||||
# Fehler, welche im getpositions auftreten weiterführen: im Layout fehlende Dists / Sensoren / fehlende Attribute
|
||||
errors_dists = rawdata["not_found"]["missing_distributors"]
|
||||
errors_sensors = rawdata["not_found"]["missing_sensors"]
|
||||
errors_attributes = rawdata["not_found"]["missing_attributes"]
|
||||
errors_dists = list()
|
||||
errors_sensors = list()
|
||||
errors_attributes = dict()
|
||||
if "not_found" in rawdata:
|
||||
if "missing_distributors" in rawdata["not_found"]:
|
||||
errors_dists = rawdata["not_found"]["missing_distributors"]
|
||||
if "missing_sensors" in rawdata["not_found"]:
|
||||
errors_sensors = rawdata["not_found"]["missing_sensors"]
|
||||
if "missing_attributes" in rawdata["not_found"]:
|
||||
errors_attributes = rawdata["not_found"]["missing_attributes"]
|
||||
|
||||
|
||||
return (dracks, dsensors, dsubdists, mapping, dtunnels, dtunlength, errors_dists, errors_sensors, errors_attributes)
|
||||
|
||||
Reference in New Issue
Block a user