From 0637ca1c9758641cba422313c366e2453bc255e3 Mon Sep 17 00:00:00 2001 From: Floke Date: Mon, 30 Jun 2025 07:27:59 +0000 Subject: [PATCH] bugfix --- helpers.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/helpers.py b/helpers.py index 25c8457e..2c99f41a 100644 --- a/helpers.py +++ b/helpers.py @@ -694,18 +694,20 @@ def load_target_schema(csv_filepath=BRANCH_MAPPING_FILE): globals()['TARGET_SCHEMA_STRING'] = "Ziel-Branchenschema nicht verfuegbar (Datei leer)." globals()['FOCUS_BRANCHES_PROMPT_PART'] = "" globals()['ALLOWED_TARGET_BRANCHES'] = [] - return False # WICHTIG: Rückgabe bei Fehler + return False for row_num, row in enumerate(reader, 1): line_count = row_num - if not row: continue + if not row or len(row) < 2: continue # Überspringe leere Zeilen oder Zeilen mit weniger als 2 Spalten - if len(row) >= 1: - target_branch = row[0].strip() - if target_branch: - allowed_branches_set.add(target_branch) - if len(row) >= 2 and row[1].strip().upper() in ["X", "FOKUS", "JA", "TRUE", "1"]: - focus_branches_set.add(target_branch) + # <<< GEÄNDERT: Lese die Zielbranche aus der ZWEITEN Spalte (Index 1) + target_branch = row[1].strip() + if target_branch: + allowed_branches_set.add(target_branch) + # <<< GEÄNDERT: Prüfe optional die DRITTE Spalte (Index 2) für Fokus-Marker + if len(row) >= 3 and row[2].strip().upper() in ["X", "FOKUS", "JA", "TRUE", "1"]: + focus_branches_set.add(target_branch) + logger.debug(f" -> Fokusbranche gefunden: '{target_branch}'") except FileNotFoundError: logger.critical(f"FEHLER: Schema-Datei '{csv_filepath}' nicht gefunden.") globals()['TARGET_SCHEMA_STRING'] = "Ziel-Branchenschema nicht verfuegbar (Datei nicht gefunden)."