Skip to content

Commit

Permalink
Correct case of multiple WHEREs
Browse files Browse the repository at this point in the history
  • Loading branch information
dmannarino committed Dec 21, 2024
1 parent d633596 commit 7f5e9f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/routes/thematic/geoencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def _admin_boundary_lookup_sql(
f" WHERE country='{country_name}'"
)
if region_name is not None:
sql += f" AND WHERE name_1='{region_name}'"
sql += f" AND name_1='{region_name}'"
if subregion_name is not None:
sql += f" AND WHERE name_2='{subregion_name}'"
sql += f" AND name_2='{subregion_name}'"

return sql

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def test__admin_boundary_lookup_sql_country_region() -> None:
assert sql == (
"SELECT gid_0, gid_1, gid_2, country, name_1, name_2 FROM some_dataset"
" WHERE country='some_country'"
" AND WHERE name_1='some_region'"
" AND name_1='some_region'"
)


Expand All @@ -39,8 +39,8 @@ async def test__admin_boundary_lookup_sql_all() -> None:
assert sql == (
"SELECT gid_0, gid_1, gid_2, country, name_1, name_2 FROM some_dataset"
" WHERE country='some_country'"
" AND WHERE name_1='some_region'"
" AND WHERE name_2='some_subregion'"
" AND name_1='some_region'"
" AND name_2='some_subregion'"
)


Expand Down

0 comments on commit 7f5e9f3

Please sign in to comment.