migrate.py: Update payment_variation migration for invalid sortid/attrid combos

This commit is contained in:
2024-01-10 10:26:49 +01:00
parent 4d1a628b45
commit 19aedaad0d

View File

@ -1439,7 +1439,8 @@ def migrate_deliveries(in_dir: str, out_dir: str) -> None:
attributes.remove('F')
if d['SNR'] != sortid:
SORT_MAP[f'{d["SNR"]}/{d["SANR"] or ""}'] = f'{sortid}/{",".join(list(attributes)) or ""}'
SORT_MAP[f'{d["SNR"]}/{d["SANR"] or ""}'] = f'{sortid}/{",".join(list(attributes)) or ""}' \
if len(attributes) > 0 else None
line = f'{d["SNR"]}/{d["SANR"]} -> {sortid}/{",".join(list(attributes)) or None}'
if line not in updated_varieties:
updated_varieties[line] = 0
@ -1646,6 +1647,8 @@ def migrate_payments(in_dir: str, out_dir: str) -> None:
if s['Oechsle'] is None:
continue
key = SORT_MAP.get(f'{s["SNR"]}/{s["SANR"] or ""}', f'{s["SNR"].upper()}/{s["SANR"] or ""}')
if key is None:
continue
azs[key] = azs.get(key, {'Gebunden': {}, 'NichtGebunden': {}})
azs[key]['Gebunden' if s['gebunden'] else 'NichtGebunden'][s['Oechsle']] = s['Betrag']
curves = []
@ -1700,6 +1703,8 @@ def migrate_payments(in_dir: str, out_dir: str) -> None:
del q['ID']
qualid = QUAL_MAP[q['QSNR']]
key = SORT_MAP.get(f'{q["SNR"]}/{q["SANR"] or ""}', f'{q["SNR"].upper()}/{q["SANR"] or ""}')
if key is None:
continue
azq[qualid] = azq.get(qualid, {})
azq[qualid][key] = q['Betrag']
for qualid, d1 in azq.items():