tentative de corriger le problème des faux doublons
This commit is contained in:
parent
e99a2e1cc0
commit
85b970ce3f
@ -144,20 +144,16 @@ class DuplicatedEvents(models.Model):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def get_item_comparion(self, attr):
|
def get_item_comparison(self, attr):
|
||||||
values = [getattr(e, attr) for e in self.get_duplicated()]
|
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:
|
if len(set([str(v) for v in values])) == 1:
|
||||||
hashable_values = "; ".join([str(v) for v in values])
|
|
||||||
else:
|
|
||||||
hashable_values = values
|
|
||||||
if len(set(hashable_values)) == 1:
|
|
||||||
return { "similar": True, "key": attr, "values": values[0] }
|
return { "similar": True, "key": attr, "values": values[0] }
|
||||||
else:
|
else:
|
||||||
return { "similar": False, "key": attr, "values": values }
|
return { "similar": False, "key": attr, "values": values }
|
||||||
|
|
||||||
def get_items_comparison(self):
|
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):
|
class Event(models.Model):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user