Skip to content
Snippets Groups Projects
Commit c09504c2 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

FIX: keyError when only one record has datatype, unit or value

parent 02ad8881
No related branches found
No related tags found
2 merge requests!71Release 0.9,!70F fix merge key word
Pipeline #28788 passed
...@@ -338,11 +338,14 @@ def merge_entities(entity_a: Entity, entity_b: Entity): ...@@ -338,11 +338,14 @@ def merge_entities(entity_a: Entity, entity_b: Entity):
raise NotImplementedError() raise NotImplementedError()
for attribute in ("datatype", "unit", "value"): for attribute in ("datatype", "unit", "value"):
if diff_r1["properties"][key][attribute] is None: if (attribute in diff_r2["properties"][key] and
setattr(entity_a.get_property(key), attribute, diff_r2["properties"][key][attribute] is not None):
diff_r2["properties"][key][attribute]) print(diff_r2["properties"][key][attribute])
else: if (diff_r1["properties"][key][attribute] is None):
raise RuntimeError("Merge conflict.") setattr(entity_a.get_property(key), attribute,
diff_r2["properties"][key][attribute])
else:
raise RuntimeError("Merge conflict.")
else: else:
# TODO: This is a temporary FIX for # TODO: This is a temporary FIX for
# https://gitlab.indiscale.com/caosdb/src/caosdb-pylib/-/issues/105 # https://gitlab.indiscale.com/caosdb/src/caosdb-pylib/-/issues/105
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment