Set usage to unknown if it cannot be determined.

This commit is contained in:
Guille Gutierrez 2023-02-24 16:33:42 -05:00
parent 3d883fc068
commit 3a7dccff8c

View File

@ -60,6 +60,9 @@ class City(Repository):
for building in city.buildings: for building in city.buildings:
object_usage = '' object_usage = ''
for internal_zone in building.internal_zones: for internal_zone in building.internal_zones:
if internal_zone is None or internal_zone.usages is None:
object_usage = 'Unknown'
else:
for usage in internal_zone.usages: for usage in internal_zone.usages:
object_usage = f'{object_usage}{usage.name}_{usage.percentage} ' object_usage = f'{object_usage}{usage.name}_{usage.percentage} '
object_usage = object_usage.rstrip() object_usage = object_usage.rstrip()