partial implementation of search by alias
This commit is contained in:
parent
146ac487ad
commit
e96a4262a7
|
@ -152,8 +152,14 @@ class CityObject(Repository):
|
||||||
buildings = session.execute(select(Model).where(
|
buildings = session.execute(select(Model).where(
|
||||||
Model.city_id.in_(ids), Model.name.in_(names)
|
Model.city_id.in_(ids), Model.name.in_(names)
|
||||||
))
|
))
|
||||||
|
if len(buildings) == 0:
|
||||||
|
# search by aliases instead
|
||||||
|
buildings = session.execute(select(Model).where(
|
||||||
|
Model.city_id.in_(ids), Model.name.in_(names)
|
||||||
|
))
|
||||||
results = [r[0] for r in buildings]
|
results = [r[0] for r in buildings]
|
||||||
print(ids, buildings)
|
|
||||||
|
print(ids, [r.name for r in results])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_by_name_or_alias_and_city(self, name, city_id) -> Union[Model, None]:
|
def get_by_name_or_alias_and_city(self, name, city_id) -> Union[Model, None]:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user