sort obstacles properly
This commit is contained in:
parent
6f19a8d71d
commit
8cdd3138f6
2 changed files with 3 additions and 1 deletions
|
@ -178,6 +178,7 @@ class Obstacle(SpaceGeometryMixin, models.Model):
|
|||
verbose_name = _('Obstacle')
|
||||
verbose_name_plural = _('Obstacles')
|
||||
default_related_name = 'obstacles'
|
||||
ordering = ('altitude', 'height')
|
||||
|
||||
def get_geojson_properties(self, *args, instance=None, **kwargs) -> dict:
|
||||
result = super().get_geojson_properties(*args, **kwargs)
|
||||
|
@ -209,6 +210,7 @@ class LineObstacle(SpaceGeometryMixin, models.Model):
|
|||
verbose_name = _('Line Obstacle')
|
||||
verbose_name_plural = _('Line Obstacles')
|
||||
default_related_name = 'lineobstacles'
|
||||
ordering = ('altitude', 'height')
|
||||
|
||||
def get_geojson_properties(self, *args, instance=None, **kwargs) -> dict:
|
||||
result = super().get_geojson_properties(*args, **kwargs)
|
||||
|
|
|
@ -148,7 +148,7 @@ class LevelGeometries:
|
|||
restricted_spaces_outdoors.setdefault(access_restriction, []).append(buffered_column)
|
||||
access_restriction_affected.setdefault(access_restriction, []).append(column.geometry)
|
||||
|
||||
for obstacle in space.obstacles.all():
|
||||
for obstacle in sorted(space.obstacles.all(), key=lambda o: o.height+o.altitude):
|
||||
if not obstacle.height:
|
||||
continue
|
||||
obstacles.setdefault(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue