persistence performance improvements

This commit is contained in:
Guille Gutierrez 2023-11-20 15:38:49 +01:00
parent 601058fc5e
commit fca74eeb08

View File

@ -75,6 +75,7 @@ class DBControl:
:
"""
cities = self._city.get_by_user_id_application_id_and_scenario(user_id, application_id, scenario)
c = [c[0].id for c in cities]
for city in cities:
result = self.building_info(name, city[0].id)
if result is not None:
@ -90,6 +91,15 @@ class DBControl:
"""
return self._city_object.get_by_name_or_alias_and_city(name, city_id)
def building_info_in_cities(self, name, cities) -> CityObject:
"""
Retrieve the building info from the database
:param name: Building name
:param cities: [City ID]
:return: CityObject
"""
return self._city_object.get_by_name_or_alias_in_cities(name, cities)
def buildings_info(self, request_values, city_id) -> [CityObject]:
"""
Retrieve the buildings info from the database