Skip to content

Commit

Permalink
Adding unique_values_list to loop in case of duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianForeman committed Jul 30, 2024
1 parent 00ad08d commit 245ac09
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions django/api/services/spreadsheet_uploader_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,11 @@ def location_checker(df, *columns, batch_size=50, **kwargs):
map_of_values_to_indices = get_map_of_values_to_indices(series, kwargs.get("indices_offset", 0))
values = series.to_list()
unique_values = set(series)
unique_values_list = list(values)

communities = set()
for i in range(0, len(values), batch_size):
batch_values = values[i:i + batch_size]
for i in range(0, len(unique_values_list), batch_size):
batch_values = unique_values_list[i:i + batch_size]
# Send request to API with list of names, returns all the communities that somewhat matched
get_placename_matches(batch_values, 200, 1, communities)

Expand Down

0 comments on commit 245ac09

Please sign in to comment.