From 061952eb179bc779cc4c15ada7896f97198e6e02 Mon Sep 17 00:00:00 2001 From: Guille Date: Mon, 29 May 2023 11:13:49 -0400 Subject: [PATCH] Add roof area to the persistence --- hub/persistence/db_setup.py | 2 +- hub/persistence/models/city_object.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hub/persistence/db_setup.py b/hub/persistence/db_setup.py index 6df86c00..cb8bf338 100644 --- a/hub/persistence/db_setup.py +++ b/hub/persistence/db_setup.py @@ -6,7 +6,7 @@ Project Coder Peter Yefi peteryefi@gmail.com """ import logging -from hub.persistence import Repository +from hub.persistence.repository import Repository from hub.persistence.models import Application from hub.persistence.models import City from hub.persistence.models import CityObject diff --git a/hub/persistence/models/city_object.py b/hub/persistence/models/city_object.py index a560a959..b7f2ace9 100644 --- a/hub/persistence/models/city_object.py +++ b/hub/persistence/models/city_object.py @@ -32,6 +32,7 @@ class CityObject(Models): total_heating_area = Column(Float, nullable=False) wall_area = Column(Float, nullable=False) windows_area = Column(Float, nullable=False) + roof_area = Column(Float, nullable=False) system_name = Column(String, nullable=False) created = Column(DateTime, default=datetime.datetime.utcnow) updated = Column(DateTime, default=datetime.datetime.utcnow) @@ -46,6 +47,7 @@ class CityObject(Models): self.usage = building.usages_percentage self.volume = building.volume self.area = building.floor_area + self.roof_area = sum(roof.solid_polygon.area for roof in building.roofs) storeys = building.storeys_above_ground if storeys is None: storeys = building.max_height / building.average_storey_height