Update collection.py

This commit is contained in:
Hellow 2023-03-03 12:39:43 +01:00
parent 7502a38b58
commit a95c83b01c

View File

@ -66,11 +66,15 @@ class Collection:
for source_url in element.source_url_map: for source_url in element.source_url_map:
if source_url in self._by_url: if source_url in self._by_url:
if merge_on_conflict:
self._by_url[source_url].merge(element)
return return
for attr in self.map_attributes: for attr in self.map_attributes:
value = element.__getattribute__(attr) value = element.__getattribute__(attr)
if value in self._by_attribute[attr]: if value in self._by_attribute[attr]:
if merge_on_conflict:
self._by_attribute[attr][value].merge(element)
return return
self._data.append(element) self._data.append(element)