From 135c5d2da328a85a5d24a4dea6342d73f945dc91 Mon Sep 17 00:00:00 2001 From: Joel Addison Date: Thu, 18 Jan 2018 19:15:59 +1100 Subject: [PATCH] Add track to schedule JSON Include the track of the slow in the schedule JSON so the miniconf can be identified. --- vendor/symposion/schedule/views.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/vendor/symposion/schedule/views.py b/vendor/symposion/schedule/views.py index c19271bd..f4e0501f 100644 --- a/vendor/symposion/schedule/views.py +++ b/vendor/symposion/schedule/views.py @@ -215,14 +215,17 @@ def schedule_json(request): protocol = request.META.get('HTTP_X_FORWARDED_PROTO', 'http') data = [] for slot in slots: + rooms = list(slot.rooms) slot_data = { - "room": ", ".join(room["name"] for room in slot.rooms.values()), - "rooms": [room["name"] for room in slot.rooms.values()], + "room": ", ".join(room.name for room in rooms), + "rooms": [room.name for room in rooms], "start": slot.start_datetime.isoformat(), "end": slot.end_datetime.isoformat(), "duration": slot.length_in_minutes, "kind": slot.kind.label, "section": slot.day.schedule.section.slug, + "section_name": slot.day.schedule.section.name, + "track": None, "conf_key": slot.pk, # TODO: models should be changed. # these are model features from other conferences that have forked symposion @@ -237,6 +240,12 @@ def schedule_json(request): if slot.content.unpublish and not request.user.is_staff: continue + track_name = None + if len(rooms) == 1: + track = rooms[0].track_set.filter(day=slot.day).first() + if track: + track_name = track.name + slot_data.update({ "name": slot.content.title, "authors": [s.name for s in slot.content.speakers()], @@ -250,7 +259,8 @@ def schedule_json(request): reverse("schedule_presentation_detail", args=[slot.content.pk]) ), "cancelled": slot.content.cancelled, - "released": slot.content.proposal.recording_release + "released": slot.content.proposal.recording_release, + "track": track_name, }) if not slot.content.speaker.twitter_username == '': slot_data["twitter_id"] = slot.content.speaker.twitter_username