From a25ef87c045fbd259497425dcfce91bfacab3ddd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Thu, 8 Sep 2022 15:44:33 +0200
Subject: [PATCH] FIX: if multiple updates for one entity exist, the retrieve
 would result in an slim <Entity id='255'/> object

---
 src/caosadvancedtools/cache.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/caosadvancedtools/cache.py b/src/caosadvancedtools/cache.py
index 54ec006f..59455d8d 100644
--- a/src/caosadvancedtools/cache.py
+++ b/src/caosadvancedtools/cache.py
@@ -300,8 +300,10 @@ class Cache(AbstractCache):
         if entities is None:
             # TODO this might become a problem. If many entities are cached,
             # then all of them are retrieved here...
+            ids = [c_id for c_id, _ in res]
+            ids = set(ids)
             entities = db.Container()
-            entities.extend([db.Entity(id=c_id) for c_id, _ in res])
+            entities.extend([db.Entity(id=c_id) for c_id in ids])
             entities.retrieve()
 
         v = {c_id: c_version for c_id, c_version in res}
-- 
GitLab