api: return also recurring events in agendas events endpoint (#73062)
This commit is contained in:
parent
662785c072
commit
e6ebff7878
|
@ -2164,7 +2164,7 @@ class MultipleAgendasEvents(APIView):
|
|||
events += get_objects_from_slugs(
|
||||
event_slugs,
|
||||
qs=agendas_by_slug[agenda_slug]
|
||||
.event_set.filter(cancelled=False, recurrence_days__isnull=True)
|
||||
.event_set.filter(cancelled=False)
|
||||
.prefetch_related(Prefetch('primary_event', queryset=Event.objects.all().order_by()))
|
||||
.order_by(),
|
||||
prefix='%s@' % agenda_slug,
|
||||
|
|
|
@ -892,21 +892,6 @@ def test_events(app, user):
|
|||
assert resp.json['err'] == 1
|
||||
assert resp.json['err_desc'] == 'invalid slugs: foo@cancelled'
|
||||
|
||||
# primary event in list
|
||||
resp = app.get(
|
||||
'/api/agendas/events/',
|
||||
params={
|
||||
'slots': [
|
||||
'bar@event-slug',
|
||||
'foo@recurring-event-slug--2022-07-01-1600',
|
||||
'foo@recurring-event-slug',
|
||||
]
|
||||
},
|
||||
status=400,
|
||||
)
|
||||
assert resp.json['err'] == 1
|
||||
assert resp.json['err_desc'] == 'invalid slugs: foo@recurring-event-slug'
|
||||
|
||||
# bad event format
|
||||
resp = app.get(
|
||||
'/api/agendas/events/',
|
||||
|
@ -930,6 +915,7 @@ def test_events(app, user):
|
|||
'slots': [
|
||||
'bar@event-slug',
|
||||
'foo@recurring-event-slug--2022-07-01-1600',
|
||||
'foo@recurring-event-slug',
|
||||
]
|
||||
},
|
||||
)
|
||||
|
@ -968,6 +954,23 @@ def test_events(app, user):
|
|||
'url': None,
|
||||
'waiting_list_places': 0,
|
||||
},
|
||||
{
|
||||
'agenda': 'foo',
|
||||
'description': None,
|
||||
'duration': None,
|
||||
'label': 'Recurring Event Label',
|
||||
'places': 10,
|
||||
'pricing': None,
|
||||
'primary_event': None,
|
||||
'publication_datetime': None,
|
||||
'recurrence_days': [4],
|
||||
'recurrence_end_date': '2022-07-09',
|
||||
'recurrence_week_interval': 1,
|
||||
'slug': 'recurring-event-slug',
|
||||
'start_datetime': '2022-07-01T16:00:00+02:00',
|
||||
'url': None,
|
||||
'waiting_list_places': 0,
|
||||
},
|
||||
]
|
||||
# result sorting ?
|
||||
with CaptureQueriesContext(connection) as ctx:
|
||||
|
@ -978,6 +981,7 @@ def test_events(app, user):
|
|||
'foo@recurring-event-slug--2022-07-01-1600',
|
||||
'bar@event-slug',
|
||||
'foo@recurring-event-slug--2022-07-08-1600',
|
||||
'foo@recurring-event-slug',
|
||||
]
|
||||
},
|
||||
)
|
||||
|
@ -988,6 +992,7 @@ def test_events(app, user):
|
|||
('foo', 'recurring-event-slug--2022-07-01-1600'),
|
||||
('bar', 'event-slug'),
|
||||
('foo', 'recurring-event-slug--2022-07-08-1600'),
|
||||
('foo', 'recurring-event-slug'),
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue