don't process sort_name or sort_mapping repeatedly

Once they're set, they should be left alone.

Maybe doing this in one loop isn't the clearest way to do it.
This commit is contained in:
Yossef Mendelssohn 2024-03-20 16:38:15 -04:00
parent 6c87b93030
commit aca30dadea

View file

@ -447,9 +447,9 @@ class DataFile:
prefix = template["move_collection_prefix"] prefix = template["move_collection_prefix"]
if prefix: if prefix:
for op in util.get_list(prefix): for op in util.get_list(prefix):
if variables[name_var].startswith(f"{op} "): if not sort_name and variables[name_var].startswith(f"{op} "):
sort_name = f"{variables[name_var][len(op):].strip()}, {op}" sort_name = f"{variables[name_var][len(op):].strip()}, {op}"
if variables["mapping_name"].startswith(f"{op} "): if not sort_mapping and variables["mapping_name"].startswith(f"{op} "):
sort_mapping = f"{variables['mapping_name'][len(op):].strip()}, {op}" sort_mapping = f"{variables['mapping_name'][len(op):].strip()}, {op}"
break if sort_name and sort_mapping break if sort_name and sort_mapping
else: else: