From 1bd7509a88d69696644e802aad3a451eaed71768 Mon Sep 17 00:00:00 2001
From: Helge Jung <hej@c3pb.de>
Date: Wed, 18 Dec 2024 22:25:40 +0100
Subject: [PATCH] c3nav integration: export assembly projects, too

---
 src/api/views/maps.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/api/views/maps.py b/src/api/views/maps.py
index c238affb7..245e265d5 100644
--- a/src/api/views/maps.py
+++ b/src/api/views/maps.py
@@ -141,7 +141,7 @@ class C3NavExportView(ConferenceSlugMixin, APIView):
         qs = self.conference.assemblies.filter(state__in=exportable_states)
         if request.GET.get('all') != '1':
             qs = qs.exclude(location_data__point=None, location_data__boundaries=None)
-        for assembly in qs:  # type: Assembly
+        for assembly in qs.all():  # type: Assembly
             loc_data = assembly.location_data or {}
             data.append(
                 {
@@ -160,6 +160,22 @@ class C3NavExportView(ConferenceSlugMixin, APIView):
                 }
             )
 
+            for project in assembly.projects.conference_accessible(self.conference):
+                data.append(
+                    {
+                        'type': 'project',
+                        'id': str(project.pk),
+                        'slug': project.slug,
+                        'name': project.name,
+                        'description': {'de': project.description_de, 'en': project.description_en},
+                        'public_url': hub_absolute('plainui:project', slug=project.slug),
+                        'assembly_id': str(assembly.pk),
+                        'floor': assembly.get_location_floor_index(),  # TODO: allow project-specific location floor
+                        'location': loc_data.get('point'),  # TODO: allow project-specific location point
+                        'location_text': project.location,
+                    }
+                )
+
         for poi in self.conference.pois.filter(visible=True):  # type: MapPOI
             data.append(
                 {
-- 
GitLab