api: add duration to meeting fillslot result (#27900)

This commit is contained in:
Frédéric Péters 2018-11-13 19:36:05 +01:00
parent e71e9f559d
commit 07e3e5180f
2 changed files with 2 additions and 0 deletions

View File

@ -467,6 +467,7 @@ class Fillslots(APIView):
reverse('api-accept-booking', kwargs={'booking_pk': primary_booking.id}))
if agenda.kind == 'meetings':
response['end_datetime'] = localtime(events[-1].end_datetime)
response['duration'] = (events[-1].end_datetime - events[-1].start_datetime).seconds // 60
if available_desk:
response['desk'] = {
'label': available_desk.label,

View File

@ -554,6 +554,7 @@ def test_booking_api_meeting(app, meetings_agenda, user):
).isoformat()[:16]
assert resp_booking.json['end_datetime'][:16] == localtime(Booking.objects.all()[0].event.end_datetime
).isoformat()[:16]
assert resp_booking.json['duration'] == 30
resp2 = app.get('/api/agenda/meetings/%s/datetimes/' % meeting_type.id)
assert len(resp.json['data']) == len([x for x in resp2.json['data'] if not x.get('disabled')]) + 1