Skip to content
Snippets Groups Projects

F fix compare entities branch2

Merged Alexander Schlemmer requested to merge f-fix-compare-entities-branch2 into dev
1 unresolved thread
Files
3
+ 6
9
@@ -30,15 +30,15 @@ Some simplified functions for generation of records etc.
import sys
import tempfile
from collections.abc import Iterable
import warnings
from collections.abc import Iterable
from subprocess import call
from caosdb.common.datatype import (BOOLEAN, DATETIME, DOUBLE, FILE, INTEGER,
REFERENCE, TEXT, is_reference)
from caosdb.common.models import (Container, Entity, File, Property, Query,
Record, RecordType, get_config,
execute_query)
Record, RecordType, execute_query,
get_config)
def new_record(record_type, name=None, description=None,
@@ -632,16 +632,12 @@ def compare_entities(old_entity: Entity, new_entity: Entity):
newdiff["properties"][prop.name]["importance"] = \
new_entity.get_importance(prop.name)
if ((prop.datatype is not None and
matching[0].datatype is not None) and
(prop.datatype != matching[0].datatype)):
if (prop.datatype != matching[0].datatype):
olddiff["properties"][prop.name]["datatype"] = prop.datatype
newdiff["properties"][prop.name]["datatype"] = \
matching[0].datatype
if ((prop.value is not None and
matching[0].value is not None) and
(prop.value != matching[0].value)):
if (prop.value != matching[0].value):
olddiff["properties"][prop.name]["value"] = prop.value
newdiff["properties"][prop.name]["value"] = \
matching[0].value
@@ -723,6 +719,7 @@ def apply_to_ids(entities, func):
entities : list of Entity
func : function with one parameter.
"""
for entity in entities:
_apply_to_ids_of_entity(entity, func)
Loading