| 1696 | |
| 1697 | # Tested |
| 1698 | def add_missing_ids_to_new_relations(self): |
| 1699 | |
| 1700 | for relation_elm in self.new_instance_relations_list_no_ids: |
| 1701 | instance = relation_elm['instance'] |
| 1702 | from_ref = relation_elm['from_ref'] |
| 1703 | to_ref = relation_elm['to_ref'] |
| 1704 | if instance.from_instance_id is None: |
| 1705 | new_instance = next((item for item in self.new_added_instances if item.creation_ref_id == from_ref), |
| 1706 | None) |
| 1707 | if new_instance: |
| 1708 | instance.from_instance_id = new_instance.id |
| 1709 | |
| 1710 | if instance.to_instance_id is None: |
| 1711 | new_instance = next((item for item in self.new_added_instances if item.creation_ref_id == to_ref), |
| 1712 | None) |
| 1713 | if new_instance: |
| 1714 | instance.to_instance_id = new_instance.id |
| 1715 | |
| 1716 | instance.hash_instance() |
| 1717 | self.session.add(instance) |
| 1718 | |
| 1719 | # Tested |
| 1720 | def check_relations_id_existence(self, from_id, to_id, from_ref, to_ref): |