Skip to content

Commit

Permalink
simplified sqlalchemy request
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Corny committed Dec 15, 2024
1 parent f2ff4ff commit 53f0626
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/gn_module_zh/model/zh.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,11 @@ def get_regions(self, query):
if municipality.LiMunicipalities.insee_reg not in region_list:
region_list.append(municipality.LiMunicipalities.insee_reg)
q_region = DB.session.scalars(
select(LAreas)
.select_from(LAreas, BibAreasTypes)
select(LAreas, BibAreasTypes)
.where(
and_(LAreas.area_code.in_(region_list)),
and_(LAreas.area_code.in_(region_list),
LAreas.id_type == BibAreasTypes.id_type,
BibAreasTypes.type_name == "Régions",
BibAreasTypes.type_name == "Régions")
)
).all()
regions = [region.area_name for region in q_region]
Expand Down

0 comments on commit 53f0626

Please sign in to comment.