Skip to content
Snippets Groups Projects
Commit 7a350688 authored by HeJ's avatar HeJ
Browse files

c3nav export: publish rooms

parent 43c72f51
Branches
Tags 6.4.8
No related merge requests found
......@@ -17,11 +17,13 @@ from api.views.mixins import ConferenceSlugMixin
_cts = {} # cache of CoordTransforms (if needed)
q_publishable_location_states = Q(location_state__in=[Assembly.LocationState.PREVIEW, Assembly.LocationState.FINAL])
def get_exportable_assemblies(conference: Conference) -> QuerySet[Assembly]:
"""Fetches all assemblies in the given conference with publish-able location."""
exportable_states = [*Assembly.PUBLIC_STATES, Assembly.State.HIDDEN]
q_placed_assemblies = Q(location_state__in=[Assembly.LocationState.PREVIEW, Assembly.LocationState.FINAL])
return Assembly.objects.filter(conference=conference, state__in=exportable_states).filter(q_placed_assemblies)
return Assembly.objects.filter(conference=conference, state__in=exportable_states).filter(q_publishable_location_states)
def get_field_geojson(value, srid: int, ct_cache: dict | None = None):
......@@ -162,6 +164,7 @@ class C3NavExportView(ConferenceSlugMixin, APIView):
'children': get_exportable_assemblies(conference=self.conference).filter(parent=assembly).values_list('slug', flat=True)
if assembly.is_cluster
else None,
'rooms': assembly.rooms.filter(q_publishable_location_states).exclude(blocked=True).values_list('slug', flat=True),
'floor': assembly.get_location_floor_index(),
'is_preview': assembly.location_state != Assembly.LocationState.FINAL,
'location': loc_data.get('point'), # assembly.get_location_point_xy(),
......@@ -185,6 +188,23 @@ class C3NavExportView(ConferenceSlugMixin, APIView):
}
)
for room in self.conference.rooms.filter(q_publishable_location_states).exclude(blocked=True):
data.append(
{
'type': 'room',
'id': str(room.pk),
'name': room.name,
'is_official': room.is_official,
'in_public_fahrplan': room.is_public_fahrplan,
'description': {'de': room.description_de, 'en': room.description_en},
'public_url': hub_absolute('plainui:room', slug=room.slug, i18n=False),
'is_preview': room.location_state != Assembly.LocationState.FINAL,
'floor': room.get_location_floor_index(),
'location': room.get_location_point_xy(),
'polygons': room.get_location_boundaries_xy(),
}
)
for poi in self.conference.pois.filter(visible=True): # type: MapPOI
data.append(
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment