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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user