diff --git a/chrono/api/views.py b/chrono/api/views.py index 118c5024..0fa35332 100644 --- a/chrono/api/views.py +++ b/chrono/api/views.py @@ -648,6 +648,16 @@ class Fillslots(APIView): if agenda.kind == 'events' and not multiple_booking: event = events[0] response['places'] = get_event_places(event) + if agenda.kind == 'events' and multiple_booking: + response['events'] = [ + { + 'slug': x.slug, + 'text': str(x), + 'datetime': format_response_datetime(x.start_datetime), + 'description': x.description, + } + for x in events + ] return Response(response) diff --git a/tests/test_api.py b/tests/test_api.py index add2c749..66fc3330 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1373,6 +1373,13 @@ def test_multiple_booking_api_fillslots(app, some_data, user): assert 'accept_url' not in resp.json['api'] assert 'cancel_url' in resp.json['api'] assert 'ics_url' in resp.json['api'] + resp_events = resp.json['events'] + assert len(resp_events) == len(events) + for (e, resp_e) in zip(events, resp_events): + assert e.slug == resp_e['slug'] + assert e.description == resp_e['description'] + assert str(e) == resp_e['text'] + assert localtime(e.start_datetime).strftime('%Y-%m-%d %H:%M:%S') == resp_e['datetime'] for event in events: assert Event.objects.get(id=event.id).booked_places == 3