From 245ac095b9fa0cc51261960fa06bf959aefceb55 Mon Sep 17 00:00:00 2001 From: julianforeman Date: Tue, 30 Jul 2024 14:13:31 -0700 Subject: [PATCH] Adding unique_values_list to loop in case of duplicates --- django/api/services/spreadsheet_uploader_prep.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django/api/services/spreadsheet_uploader_prep.py b/django/api/services/spreadsheet_uploader_prep.py index 094ae2b0..46740278 100644 --- a/django/api/services/spreadsheet_uploader_prep.py +++ b/django/api/services/spreadsheet_uploader_prep.py @@ -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)