This commit is contained in:
2025-06-30 07:27:59 +00:00
parent df9aa9afb4
commit 0637ca1c97

View File

@@ -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)."