From fca74eeb08cc506b6777718e9ad3e78d45721b93 Mon Sep 17 00:00:00 2001 From: guille Date: Mon, 20 Nov 2023 15:38:49 +0100 Subject: [PATCH] persistence performance improvements --- hub/persistence/db_control.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hub/persistence/db_control.py b/hub/persistence/db_control.py index c6740336..259b9dcf 100644 --- a/hub/persistence/db_control.py +++ b/hub/persistence/db_control.py @@ -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