Skip to content

Commit 362880a

Browse files
Fix bug in csv check_for_duplicates (#3060)
Fixes #1861
1 parent f6ad787 commit 362880a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/csv_overrides.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,12 @@ def check_for_duplicates(filename, default_values):
205205
for list_name, dict in default_values.items():
206206
for key, value in dict.items():
207207
if value in results_map:
208-
existing_list_name = results_map[value]["list"]
208+
existing_list_name = results_map[value]
209209
warning = f"WARNING ({filename}): Value `{value}` duplicated between lists '{existing_list_name}' and '{list_name}'"
210210
print(warning)
211211
app.notify(warning)
212+
else:
213+
results_map[value] = list_name
212214

213215

214216
def is_removed(value: str):
@@ -236,9 +238,9 @@ def update_dicts(
236238
extra_ignored_values: list[str],
237239
extra_allowed_values: list[str],
238240
allow_unknown_values: bool,
239-
default_list_name: Optional[str],
241+
default_list_name: str | None,
240242
pluralize_lists: list[str],
241-
handle_new_values: Optional[Callable[[list[SpokenFormEntry]], None]],
243+
handle_new_values: Callable[[list[SpokenFormEntry]], None] | None,
242244
):
243245
# Create map with all default values
244246
results_map: dict[str, ResultsListEntry] = {}

src/spoken_forms.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ def handle_new_values(csv_name: str, values: list[SpokenFormEntry]):
129129
update_spoken_forms_output()
130130

131131
handle_csv = auto_construct_defaults(
132-
spoken_forms, handle_new_values, init_csv_and_watch_changes
132+
spoken_forms,
133+
handle_new_values,
134+
init_csv_and_watch_changes,
133135
)
134136

135137
disposables = [

0 commit comments

Comments
 (0)