forked from s_ranjbar/city_retrofit
Bug correction in persistence
This commit is contained in:
parent
6332519e12
commit
6aafda7f42
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user