From 259275a7cc7fac02f594e4ac9430e677dbcf26e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Wed, 14 Jul 2021 13:23:08 +0200
Subject: [PATCH] resolve ref

---
 src/caosadvancedtools/structure_mapping.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/caosadvancedtools/structure_mapping.py b/src/caosadvancedtools/structure_mapping.py
index 73ddac22..dfec80ad 100644
--- a/src/caosadvancedtools/structure_mapping.py
+++ b/src/caosadvancedtools/structure_mapping.py
@@ -59,7 +59,7 @@ def collect_existing_structure(target_structure, existing_root, em):
         if prop.value is None:
             continue
 
-        if not prop.is_reference():
+        if not prop.is_reference(server_retrieval=True):
             continue
 
         # TODO case where multiple properties of same name exist is not
@@ -70,6 +70,7 @@ def collect_existing_structure(target_structure, existing_root, em):
             resolve_reference(prop)
 
             # TODO Lists of reference are not yet treated properly
+            resolve_reference(existing_root.get_property(prop.name))
             referenced = existing_root.get_property(prop.name).value
 
             if not isinstance(referenced, list):
@@ -107,7 +108,7 @@ def update_structure(em, updating: db.Container, target_structure: db.Record):
                               em.to_existing[target_structure._cuid])
 
     for prop in target_structure.get_properties():
-        if prop.is_reference():
+        if prop.is_reference(server_retrieval=True):
             update_structure(em, updating, prop.value)
 
 # TODO this can be moved to the general lib; it is the general case that
-- 
GitLab