Enhance VocabService and VocabLessonView for review lesson functionality

- Added logic in VocabService to retrieve vocabulary and lessons from previous lessons for review sessions, improving the learning experience.
- Implemented methods to gather review lessons and vocabulary exercises, ensuring users have access to relevant content during review lessons.
- Updated VocabLessonView to utilize review vocabulary exercises when in a review lesson, enhancing vocabulary extraction and user feedback.
- Improved console logging for better insights into the vocabulary processing flow, aiding in debugging and user interaction.
This commit is contained in:
Torsten Schulz (local)
2026-01-19 23:33:45 +01:00
parent fe2e6a53e9
commit 69ef120677
2 changed files with 105 additions and 13 deletions

View File

@@ -390,14 +390,33 @@ export default {
importantVocab() {
// Extrahiere wichtige Begriffe aus den Übungen
try {
// Bei Wiederholungslektionen: Verwende Vokabeln aus vorherigen Lektionen
if (this.lesson && (this.lesson.lessonType === 'review' || this.lesson.lessonType === 'vocab_review')) {
if (this.lesson.reviewVocabExercises && Array.isArray(this.lesson.reviewVocabExercises)) {
console.log('[importantVocab] Wiederholungslektion - verwende reviewVocabExercises:', this.lesson.reviewVocabExercises.length);
return this._extractVocabFromExercises(this.lesson.reviewVocabExercises);
} else {
console.log('[importantVocab] Wiederholungslektion aber keine reviewVocabExercises vorhanden');
return [];
}
}
// Normale Lektion: Verwende Übungen aus der aktuellen Lektion
if (!this.lesson || !this.lesson.grammarExercises || !Array.isArray(this.lesson.grammarExercises)) {
console.log('[importantVocab] Keine Übungen vorhanden');
return [];
}
const vocabMap = new Map();
this.lesson.grammarExercises.forEach((exercise, idx) => {
return this._extractVocabFromExercises(this.lesson.grammarExercises);
} catch (e) {
console.error('Fehler in importantVocab computed property:', e);
return [];
}
},
_extractVocabFromExercises(exercises) {
const vocabMap = new Map();
exercises.forEach((exercise, idx) => {
try {
console.log(`[importantVocab] Verarbeite Übung ${idx + 1}:`, exercise.title);
// Extrahiere aus questionData
@@ -469,15 +488,11 @@ export default {
} catch (e) {
console.warn('Fehler beim Extrahieren von Vokabeln aus Übung:', e, exercise);
}
});
const result = Array.from(vocabMap.values());
console.log(`[importantVocab] Ergebnis:`, result);
return result;
} catch (e) {
console.error('Fehler in importantVocab computed property:', e);
return [];
}
});
const result = Array.from(vocabMap.values());
console.log(`[_extractVocabFromExercises] Ergebnis:`, result.length, 'Vokabeln');
return result;
}
},
watch: {