fix: Korrigiere JSON-Datei-Ladefehler und füge Debug-Route hinzu

Co-authored-by: aider (ollama_chat/qwen3-coder:30b) <aider@aider.chat>
This commit is contained in:
jamulix 2025-10-21 15:10:43 +02:00
commit 68800a49d1

10
app.py
View file

@ -99,11 +99,21 @@ def debug():
"""Debug-Route zum Überprüfen der Lektionen und Konfiguration"""
progress = Progress.query.first()
# Versuche, den Inhalt der JSON-Datei zu lesen
json_content = "Datei nicht gefunden"
try:
if os.path.exists(DATA_PATH):
with open(DATA_PATH, "r", encoding="utf-8") as f:
json_content = f.read()
except Exception as e:
json_content = f"Fehler beim Lesen der Datei: {e}"
debug_info = {
'lessons_loaded': len(lessons),
'lessons_content': lessons,
'data_path': DATA_PATH,
'file_exists': os.path.exists(DATA_PATH),
'file_content': json_content[:500] + '...' if len(json_content) > 500 else json_content,
'current_progress': {
'current_text_index': progress.current_text_index if progress else None,
'current_position': progress.current_position if progress else None,