api: push back common criteria to 'help' PG (#77590)
This commit is contained in:
parent
31f4e5c059
commit
3318680f5f
|
@ -1903,9 +1903,13 @@ class RecurringFillslots(APIView):
|
|||
):
|
||||
event_filter = Q()
|
||||
agendas_by_slug = {a.slug: a for a in agendas}
|
||||
agenda_slugs = set()
|
||||
event_slugs = set()
|
||||
for agenda_slug, days_by_event in slots.items():
|
||||
agenda = agendas_by_slug[agenda_slug]
|
||||
agenda_slugs.add(agenda_slug)
|
||||
for event_slug, days in days_by_event.items():
|
||||
event_slugs.add(event_slug)
|
||||
lookups = {
|
||||
'agenda__slug': agenda_slug,
|
||||
'primary_event__slug': event_slug,
|
||||
|
@ -1926,6 +1930,8 @@ class RecurringFillslots(APIView):
|
|||
event_filter |= Q(**lookups)
|
||||
|
||||
events = Event.objects.filter(event_filter) if event_filter else Event.objects.none()
|
||||
if agenda_slugs:
|
||||
events = events.filter(agenda__slug__in=agenda_slugs, primary_event__slug__in=event_slugs)
|
||||
events = events.filter(start_datetime__gte=start_datetime, cancelled=False)
|
||||
if end_datetime:
|
||||
events = events.filter(start_datetime__lte=end_datetime)
|
||||
|
|
Loading…
Reference in New Issue