Skip to content

Commit

Permalink
Print how many new hints are added
Browse files Browse the repository at this point in the history
  • Loading branch information
Notexe committed Oct 23, 2023
1 parent e0fa6a4 commit d8c96b6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/add_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

modified_types = set()
paths_added = 0
hints_added = 0

def update_data(data, hash_val, path_val):
global paths_added
global hints_added
for entry in data.values():
if entry["hash"] == hash_val:
if ioi_hash(path_val) == hash_val:
Expand All @@ -21,6 +23,8 @@ def update_data(data, hash_val, path_val):
print(f"Hash: {hash_val} already has a path {entry['path']}. Skipping addition of hint: {path_val.lower()}.")
continue
else:
if "hint" not in entry or entry["hint"] == "":
hints_added += 1
entry["hint"] = path_val.lower()
modified_types.add(hash_type)
break
Expand All @@ -45,4 +49,10 @@ def update_data(data, hash_val, path_val):
if hash_type in modified_types:
write_json_file(os.path.join(output_directory, f"{hash_type}.json"), data)

print(f"{paths_added} new path(s) added successfully!")
if paths_added or hints_added:
if paths_added > 0:
print(f"{paths_added} new path(s) added successfully!")
if hints_added > 0:
print(f"{hints_added} new hint(s) added successfully!")
else:
print("No new paths or hints added.")

0 comments on commit d8c96b6

Please sign in to comment.