fix duplicates in search view

This commit is contained in:
Cayo Puigdefabregas 2024-10-28 18:09:45 +01:00
parent b2cda37dd0
commit 356dd590d2
1 changed files with 8 additions and 1 deletions

View File

@ -70,10 +70,17 @@ class SearchView(InventaryMixin):
return self.search_hids(query, offset, limit) return self.search_hids(query, offset, limit)
devices = [] devices = []
dev_id = []
for x in matches: for x in matches:
devices.append(self.get_annotations(x)) # devices.append(self.get_annotations(x))
dev = self.get_annotations(x)
if dev.id not in dev_id:
devices.append(dev)
dev_id.append(dev.id)
count = matches.size() count = matches.size()
# TODO fix of pagination, the count is not correct
return devices, count return devices, count
def get_annotations(self, xp): def get_annotations(self, xp):