From c079e02394156de47085714a9de59f6c0f61913d Mon Sep 17 00:00:00 2001
From: Alexander Schlemmer <alexander@mail-schlemmer.de>
Date: Thu, 16 Dec 2021 13:59:46 +0100
Subject: [PATCH] FIX: compare function did not check units

---
 src/caosdb/apiutils.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/caosdb/apiutils.py b/src/caosdb/apiutils.py
index 21a8cc7c..4ee0dacd 100644
--- a/src/caosdb/apiutils.py
+++ b/src/caosdb/apiutils.py
@@ -637,6 +637,11 @@ def compare_entities(old_entity: Entity, new_entity: Entity):
                 newdiff["properties"][prop.name]["datatype"] = \
                     matching[0].datatype
 
+            if (prop.unit != matching[0].unit):
+                olddiff["properties"][prop.name]["unit"] = prop.unit
+                newdiff["properties"][prop.name]["unit"] = \
+                    matching[0].unit
+
             if (prop.value != matching[0].value):
                 olddiff["properties"][prop.name]["value"] = prop.value
                 newdiff["properties"][prop.name]["value"] = \
-- 
GitLab