tentative de corriger le problème des faux doublons

This commit is contained in:
Jean-Marie Favreau 2024-04-23 22:46:36 +02:00
parent e99a2e1cc0
commit 85b970ce3f

View File

@ -144,20 +144,16 @@ class DuplicatedEvents(models.Model):
return result
def get_item_comparion(self, attr):
def get_item_comparison(self, attr):
values = [getattr(e, attr) for e in self.get_duplicated()]
if len([x for x in [isinstance(i, list) for i in values] if x is True]) > 0:
hashable_values = "; ".join([str(v) for v in values])
else:
hashable_values = values
if len(set(hashable_values)) == 1:
if len(set([str(v) for v in values])) == 1:
return { "similar": True, "key": attr, "values": values[0] }
else:
return { "similar": False, "key": attr, "values": values }
def get_items_comparison(self):
return [self.get_item_comparion(e) for e in Event.data_fields(all=True)]
return [self.get_item_comparison(e) for e in Event.data_fields(all=True)]
class Event(models.Model):