diff --git a/hub/persistence/db_control.py b/hub/persistence/db_control.py index f53d0d30..6a1c3ac5 100644 --- a/hub/persistence/db_control.py +++ b/hub/persistence/db_control.py @@ -122,10 +122,9 @@ class DBControl: ) if result_sets is None: continue + results[scenario_name] = [] for result_set in result_sets: city_id = result_set[0].id - - results[scenario_name] = [] for building_name in scenario[scenario_name]: _building = self._city_object.get_by_name_or_alias_and_city(building_name, city_id) if _building is None: diff --git a/hub/persistence/repositories/city.py b/hub/persistence/repositories/city.py index d1e07343..17e018a6 100644 --- a/hub/persistence/repositories/city.py +++ b/hub/persistence/repositories/city.py @@ -112,9 +112,9 @@ class City(Repository): try: with Session(self.engine) as session: result_set = session.execute(select(Model).where(Model.user_id == user_id, - Model.application_id == application_id, - Model.scenario == scenario - )).all() + Model.application_id == application_id, + Model.scenario == scenario + )).all() return result_set except SQLAlchemyError as err: logging.error('Error while fetching city by name %s', err) @@ -136,4 +136,3 @@ class City(Repository): except SQLAlchemyError as err: logging.error('Error while fetching city by name %s', err) raise SQLAlchemyError from err -