File tree Expand file tree Collapse file tree
utilities/Progress-Tracker Expand file tree Collapse file tree Original file line number Diff line number Diff 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 :
You can’t perform that action at this time.
0 commit comments