agendas: do no send reminders for secondary bookings (#83861)
gitea/chrono/pipeline/head This commit looks good Details

This commit is contained in:
Valentin Deniaud 2023-11-23 12:38:59 +01:00
parent 3161f47cd1
commit 21cd345c35
2 changed files with 4 additions and 1 deletions

View File

@ -59,6 +59,7 @@ class Command(BaseCommand):
event__start_datetime__lte=starts_before,
event__start_datetime__gte=starts_after,
in_waiting_list=False,
primary_booking__isnull=True,
**{f'{msg_type}_reminder_datetime__isnull': True},
).select_related('event', 'event__agenda', 'event__agenda__reminder_settings')

View File

@ -1914,9 +1914,11 @@ def test_agenda_reminders(mailoutbox, freezer):
event = Event.objects.create(agenda=agenda, start_datetime=start_datetime, places=10, label='Event')
for _ in range(5):
Booking.objects.create(event=event, user_email='t@test.org')
booking = Booking.objects.create(event=event, user_email='t@test.org')
# extra booking with no email, should be ignored
Booking.objects.create(event=event)
# secondary booking, should be ignored
Booking.objects.create(event=event, user_email='t@test.org', primary_booking=booking)
freezer.move_to('2020-01-02 10:00')
# not time to send reminders yet