Skip to content

Commit

Permalink
chore: allow municipality research with independant place of input wo…
Browse files Browse the repository at this point in the history
…rd in the municipality name
  • Loading branch information
ch-cbna committed Oct 14, 2024
1 parent ec2c58b commit 7d4dbdc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ref_geo/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def get_municipalities():

if "nom_com" in parameters:
search_name = request.args.get("nom_com")
search_name = search_name.replace(" ", "%") + "%"
search_name = "%" + search_name.replace(" ", "%") + "%"
q = q.where(func.unaccent(LiMunicipalities.nom_com).ilike(func.unaccent(search_name)))
limit = int(parameters.get("limit")) if parameters.get("limit") else 100

Expand Down Expand Up @@ -223,7 +223,7 @@ def get_areas():

if "area_name" in params:
search_name = request.args.get("area_name")
search_name = search_name.replace(" ", "%") + "%"
search_name = "%" + search_name.replace(" ", "%") + "%"
query = query.where(func.unaccent(LAreas.area_name).ilike(func.unaccent(search_name)))

without_geom = request.args.get("without_geom", False, lambda x: x == "true")
Expand Down

0 comments on commit 7d4dbdc

Please sign in to comment.