🔧 refactor(store.py): modify create_component function to include total count of each type in the metadata dictionary

The `create_component` function in `store.py` has been modified to include the total count of each type in the metadata dictionary. This change improves the structure of the metadata and provides more comprehensive information about the types and their counts in the nodes.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-10-27 14:04:15 -03:00
commit e621243288

View file

@ -72,7 +72,10 @@ def create_component(
# and the value is the count this type appears in the nodes
# e.g.
# {
# "SomeType": 1
# "SomeType": {
# "count": 2
# },
# "total": 2
# }
names = [node["id"].split("-")[0] for node in component.data["nodes"]]
metadata = {name: {"count": names.count(name)} for name in names}