api: return events details if multiple booking (#38330)
This commit is contained in:
parent
7a33c41586
commit
5f09ce7fdb
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue