Przeglądaj źródła

when adding a node makes the type mandatory, only add the node to instance models if it does not exists there yet

Lucas Heer 7 lat temu
rodzic
commit
72d086b888
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      evolution/node_ops.py

+ 3 - 2
evolution/node_ops.py

@@ -22,9 +22,10 @@ class NodeAdd(object):
             if check_if_last:
                 if commons.is_type_mandatory(node_type):
                     print("Type {} became mandatory, adding it to instance models ...".format(node_type))
-                    # local add made type mandatory, so need to add to instance models
+                    # local add made type mandatory, so need to add to instance models (if not exists already)
                     for im in commons.all_instance_models():
-                        self.execute(im, node_type, local=True, check_if_last=False)
+                        if not commons.all_nodes_with_type(im, self._node_type):
+                            self.execute(im, node_type, local=True, check_if_last=False)
 
         else:
             for m in commons.all_models():