Small fixes in migrate.py

This commit is contained in:
2023-03-13 23:17:55 +01:00
parent b8364e65b6
commit ffdf609b56

View File

@ -226,7 +226,7 @@ def migrate_branches(in_dir: str, out_dir: str) -> None:
with open(f'{out_dir}/branch.csv', 'w+') as f: with open(f'{out_dir}/branch.csv', 'w+') as f:
f.write('zwstid;name;country;postal_dest;address;phone_nr\n') f.write('zwstid;name;country;postal_dest;address;phone_nr\n')
for b in csv.parse(f'{in_dir}/TZweigstellen.csv'): for b in csv.parse(f'{in_dir}/TZweigstellen.csv'):
BRANCH_MAP[b['ZNR']] = b['Kennbst'] BRANCH_MAP[b['ZNR']] = b['Kennbst'].strip().title()
address = b['Straße'] address = b['Straße']
postal_dest = lookup_plz(int(b['PLZ']) if b['PLZ'] else None, b['Ort'], address) postal_dest = lookup_plz(int(b['PLZ']) if b['PLZ'] else None, b['Ort'], address)
f.write(csv.format_row(b['Kennbst'], b['Name'], 'AT', postal_dest, address, b['Telefon'])) f.write(csv.format_row(b['Kennbst'], b['Name'], 'AT', postal_dest, address, b['Telefon']))
@ -491,7 +491,8 @@ def migrate_members(in_dir: str, out_dir: str) -> None:
invalid(mgnr, 'Tel.Nr.', m['Mobiltelefon']) invalid(mgnr, 'Tel.Nr.', m['Mobiltelefon'])
else: else:
if phone_2[3] == '6': if phone_2[3] == '6':
phone_mobile.append(phone_2) if phone_2 not in phone_mobile:
phone_mobile.append(phone_2)
elif phone_landline is None: elif phone_landline is None:
phone_landline = phone_2 phone_landline = phone_2
elif phone_landline != phone_2: elif phone_landline != phone_2: