Fix #286 (again)
This commit is contained in:
parent
a714566e8d
commit
3df89e6a52
@ -1613,7 +1613,7 @@ class Event(models.Model):
|
|||||||
|
|
||||||
# Limitation: the given events should not be considered similar one to another...
|
# Limitation: the given events should not be considered similar one to another...
|
||||||
def import_events(events, remove_missing_from_source=None, user_id=None):
|
def import_events(events, remove_missing_from_source=None, user_id=None):
|
||||||
|
logger.warning("aaaaaa >>>f")
|
||||||
user = None
|
user = None
|
||||||
if user_id:
|
if user_id:
|
||||||
user = User.objects.filter(pk=user_id).first()
|
user = User.objects.filter(pk=user_id).first()
|
||||||
@ -1627,6 +1627,7 @@ class Event(models.Model):
|
|||||||
|
|
||||||
# for each event, check if it's a new one, or a one to be updated
|
# for each event, check if it's a new one, or a one to be updated
|
||||||
for event in events:
|
for event in events:
|
||||||
|
logger.warning("aaaa1 >>>f")
|
||||||
sdate = date.fromisoformat(event.start_day)
|
sdate = date.fromisoformat(event.start_day)
|
||||||
if event.end_day:
|
if event.end_day:
|
||||||
edate = date.fromisoformat(event.end_day)
|
edate = date.fromisoformat(event.end_day)
|
||||||
@ -1641,15 +1642,19 @@ 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
|
||||||
@ -1661,7 +1666,9 @@ 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:
|
||||||
@ -1680,6 +1687,7 @@ 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
|
||||||
@ -1702,6 +1710,7 @@ 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
|
||||||
@ -1722,12 +1731,14 @@ 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:
|
||||||
@ -1761,6 +1772,7 @@ 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
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ const openModal = (modal, back=true) => {
|
|||||||
visibleModal = modal;
|
visibleModal = modal;
|
||||||
|
|
||||||
const mask = visibleModal.querySelector(".h-mask");
|
const mask = visibleModal.querySelector(".h-mask");
|
||||||
if (mask)
|
if (mask != null)
|
||||||
mask.classList.add("visible");
|
mask.classList.add("visible");
|
||||||
}, 350);
|
}, 350);
|
||||||
};
|
};
|
||||||
@ -44,7 +44,7 @@ const openModal = (modal, back=true) => {
|
|||||||
const hideModal = (modal) => {
|
const hideModal = (modal) => {
|
||||||
if (modal != null) {
|
if (modal != null) {
|
||||||
const mask = visibleModal.querySelector(".h-mask");
|
const mask = visibleModal.querySelector(".h-mask");
|
||||||
if (mask)
|
if (mask != null)
|
||||||
mask.classList.remove("visible");
|
mask.classList.remove("visible");
|
||||||
visibleModal = null;
|
visibleModal = null;
|
||||||
document.documentElement.style.removeProperty("--scrollbar-width");
|
document.documentElement.style.removeProperty("--scrollbar-width");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user