Enhance logging and conditional rendering in VocabService and VocabLessonView

- Added detailed logging in VocabService for lesson retrieval, including lesson ID, title, and exercise count.
- Improved conditional rendering in VocabLessonView to handle cases where grammar exercises may not be present, enhancing user experience.
- Updated logging in VocabLessonView to provide insights into loaded lessons and exercises, aiding in debugging and monitoring.
This commit is contained in:
Torsten Schulz (local)
2026-01-19 19:12:54 +01:00
parent 0331ffeb93
commit 8f55f63f77
5 changed files with 168 additions and 8 deletions

33
check-lesson-exercises.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
# Script zum Prüfen, ob Übungen für eine Lektion vorhanden sind
# Verwendung: ./check-lesson-exercises.sh [lesson_id]
LESSON_ID="${1:-1}"
echo "🔍 Prüfe Übungen für Lektion ID: $LESSON_ID"
echo ""
psql -U yourpart -d yp3 << EOF
-- Prüfe Lektion
SELECT
l.id,
l.title,
l.course_id,
COUNT(e.id) as exercise_count
FROM community.vocab_course_lesson l
LEFT JOIN community.vocab_grammar_exercise e ON e.lesson_id = l.id
WHERE l.id = $LESSON_ID
GROUP BY l.id, l.title, l.course_id;
-- Zeige alle Übungen für diese Lektion
SELECT
e.id,
e.exercise_number,
e.title,
e.exercise_type_id,
et.name as exercise_type_name
FROM community.vocab_grammar_exercise e
LEFT JOIN community.vocab_grammar_exercise_type et ON et.id = e.exercise_type_id
WHERE e.lesson_id = $LESSON_ID
ORDER BY e.exercise_number;
EOF