From 19aedaad0d881eec973ec65f43a8ac27dcbac3a4 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Wed, 10 Jan 2024 10:26:49 +0100 Subject: [PATCH] migrate.py: Update payment_variation migration for invalid sortid/attrid combos --- wgmaster/migrate.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wgmaster/migrate.py b/wgmaster/migrate.py index 2d51cc0..aff1eb7 100755 --- a/wgmaster/migrate.py +++ b/wgmaster/migrate.py @@ -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():