On vire les trucs de logs à la con

This commit is contained in:
Jean-Marie Favreau 2025-01-25 17:40:29 +01:00
parent 71cfe1b130
commit bdcb27d473

View File

@ -1644,19 +1644,15 @@ class Event(models.Model):
if event.uuids and len(event.uuids) > 0: if event.uuids and len(event.uuids) > 0:
uuids |= set(event.uuids) uuids |= set(event.uuids)
logger.warning("aaaa2 >>>f")
# imported events should be updated # imported events should be updated
event.set_in_importation_process() event.set_in_importation_process()
event.set_processing_user(user) event.set_processing_user(user)
event.prepare_save() event.prepare_save()
logger.warning("aaaa3 >>>f")
# check if the event has already be imported (using uuid) # check if the event has already be imported (using uuid)
same_events = event.find_same_events_by_uuid() same_events = event.find_same_events_by_uuid()
if len(same_events) != 0: if len(same_events) != 0:
logger.warning("aaaa4 >>>f")
# check if one event has been imported and not modified in this list # check if one event has been imported and not modified in this list
same_imported = Event.find_last_pure_import(same_events) same_imported = Event.find_last_pure_import(same_events)
pure = True pure = True
@ -1668,9 +1664,7 @@ class Event(models.Model):
pure = False pure = False
break break
logger.warning("aaaa5 >>>f")
if same_imported: if same_imported:
logger.warning("aaaa6 >>>f")
# reopen DuplicatedEvents if required # reopen DuplicatedEvents if required
if not event.similar(same_imported, False) and same_imported.other_versions: if not event.similar(same_imported, False) and same_imported.other_versions:
if same_imported.status != Event.STATUS.TRASH: if same_imported.status != Event.STATUS.TRASH:
@ -1689,7 +1683,6 @@ class Event(models.Model):
same_imported.save(update_fields=["local_image"]) same_imported.save(update_fields=["local_image"])
to_update.append(same_imported) to_update.append(same_imported)
else: else:
logger.warning("aaaa7 >>>f")
# otherwise, the new event possibly a duplication of the remaining others. # otherwise, the new event possibly a duplication of the remaining others.
# check if it should be published # check if it should be published
@ -1712,7 +1705,6 @@ class Event(models.Model):
# import this new event # import this new event
to_import.append(event) to_import.append(event)
logger.warning("aaaa666 >>>f")
for e in to_import: for e in to_import:
if e.is_event_long_duration(): if e.is_event_long_duration():
e.status = Event.STATUS.DRAFT e.status = Event.STATUS.DRAFT
@ -1733,14 +1725,12 @@ class Event(models.Model):
msg = ti.get_message() msg = ti.get_message()
msg.related_event = i msg.related_event = i
msg.save() msg.save()
logger.warning("bbbbbb >>>f")
nb_updated = Event.objects.bulk_update( nb_updated = Event.objects.bulk_update(
to_update, to_update,
fields=Event.data_fields(no_m2m=True) fields=Event.data_fields(no_m2m=True)
+ ["imported_date", "modified_date", "uuids", "status", "import_sources"], + ["imported_date", "modified_date", "uuids", "status", "import_sources"],
) )
logger.warning("ccccccc >>>f")
nb_draft = 0 nb_draft = 0
if remove_missing_from_source is not None and max_date is not None: if remove_missing_from_source is not None and max_date is not None:
@ -1774,7 +1764,6 @@ class Event(models.Model):
to_draft.append(e) to_draft.append(e)
nb_draft = Event.objects.bulk_update(to_draft, fields=["status"]) nb_draft = Event.objects.bulk_update(to_draft, fields=["status"])
logger.warning("dddddd >>>f")
return imported, nb_updated, nb_draft return imported, nb_updated, nb_draft