Skip to content

Commit

Permalink
Merge pull request #1229 from LKuemmel/hierarchy
Browse files Browse the repository at this point in the history
fix validate hierarchy if evu counter is missing
  • Loading branch information
LKuemmel authored Dec 1, 2023
2 parents c055abe + ac19739 commit cb472df
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/control/counter_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,18 @@ def check_and_add(type_name: ComponentType, data_structure):
if break_flag:
break
else:
self.hierarchy_add_item_below(entry_num, type_name, self.get_evu_counter().num)
try:
self.hierarchy_add_item_below(entry_num, type_name, self.get_evu_counter().num)
except (TypeError, IndexError):
# es gibt noch keinen EVU-Zähler
hierarchy = [{
"id": entry_num,
"type": ComponentType.COUNTER.value,
"children": data.data.counter_all_data.data.get.hierarchy
}]
Pub().pub("openWB/set/counter/get/hierarchy", hierarchy)
data.data.counter_all_data.data.get.hierarchy = hierarchy

pub_system_message({}, f"{component_type_to_readable_text(type_name)} mit ID {element['id']} wurde"
" in der Hierarchie hinzugefügt, da kein Eintrag in der Hierarchie gefunden "
"wurde. Bitte prüfe die Anordnung der Komponenten in der Hierarchie.",
Expand Down

0 comments on commit cb472df

Please sign in to comment.