Skip to content

Commit 04a423b

Browse files
committed
fix: migration mapping
1 parent 6f7945d commit 04a423b

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

utilities/Progress-Tracker/Progress-Tracker.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,26 @@ def load_data() -> dict:
5050
if os.path.exists(DATA_FILE):
5151
with open(DATA_FILE, "r") as f:
5252
data = json.load(f)
53-
# Migrate old names to new folder names
53+
# Migrate old names to new folder names (corrected mappings)
5454
migrations = {
55-
"Dice-Rolling": "Roling-Dice",
56-
"Coin-Flip": "Flipping-toss",
55+
"Dice-Rolling": "Rolling-Dice",
56+
"Coin-Flip": "Flipping-Toss",
5757
"Pascals-Triangle": "Pascal-Triangle"
5858
}
5959
completed = data.get("completed", {})
6060
updated_completed = {}
6161
mutated = False
6262
for k, v in completed.items():
6363
if k in migrations:
64-
updated_completed[migrations[k]] = v
65-
mutated = True
64+
new_key = migrations[k]
65+
# Validate: only migrate if the new key exists in the registry
66+
if new_key in ALL_PROJECT_NAMES:
67+
updated_completed[new_key] = v
68+
mutated = True
69+
else:
70+
# If new key doesn't exist in registry, keep old key and warn
71+
print(f"⚠️ Warning: migration target '{new_key}' not found in registry. Keeping old key '{k}'.")
72+
updated_completed[k] = v
6673
else:
6774
updated_completed[k] = v
6875
if mutated:

0 commit comments

Comments
 (0)