take location into consideration when finding adjacent eventsessions

This commit is contained in:
Thomas Steen Rasmussen 2020-06-22 01:09:45 +02:00
parent 36fef3b4ea
commit fdc92ec7f2

View file

@ -49,14 +49,14 @@ class Command(BaseCommand):
sa.when = (sa.when.lower, instance.when.upper) sa.when = (sa.when.lower, instance.when.upper)
sa.save() sa.save()
logger.info( logger.info(
f"extended speakeravailability {sa} to include instance {instance}" f"extended speakeravailability {sa} for speaker {speaker} to include instance {instance}"
) )
except SpeakerAvailability.DoesNotExist: except SpeakerAvailability.DoesNotExist:
sa = SpeakerAvailability.objects.create( sa = SpeakerAvailability.objects.create(
speaker=speaker, when=instance.when, available=True, speaker=speaker, when=instance.when, available=True,
) )
logger.info( logger.info(
f"created speakeravailability {sa} for instance {instance}" f"created speakeravailability {sa} for speaker {speaker} for instance {instance}"
) )
except SpeakerAvailability.MultipleObjectsReturned: except SpeakerAvailability.MultipleObjectsReturned:
# who the hell does three events in a row?! # who the hell does three events in a row?!
@ -93,6 +93,7 @@ class Command(BaseCommand):
when__adjacent_to=instance.when, when__adjacent_to=instance.when,
event_type_id=event_type_id, event_type_id=event_type_id,
event_duration_minutes=duration, event_duration_minutes=duration,
event_location=instance.location,
) )
logger.info( logger.info(
f"found existing eventsession adjacent to instance {instance}" f"found existing eventsession adjacent to instance {instance}"