diff --git a/frontend/src/views/social/VocabLessonView.vue b/frontend/src/views/social/VocabLessonView.vue index 341b291..31d7e19 100644 --- a/frontend/src/views/social/VocabLessonView.vue +++ b/frontend/src/views/social/VocabLessonView.vue @@ -369,23 +369,24 @@ export default { const question = qData.question || qData.text || ''; console.log(`[importantVocab] Frage:`, question); - // Pattern 1: "Wie sagt man 'X' auf Bisaya?" -> X ist Deutsch, correctAnswer ist Bisaya + // Pattern 1: "Wie sagt man 'X' auf Bisaya?" -> X ist Muttersprache (z.B. "Großmutter"), correctAnswer ist Bisaya (z.B. "Lola") let match = question.match(/['"]([^'"]+)['"]/); if (match) { - const germanWord = match[1]; - console.log(`[importantVocab] Pattern 1 gefunden - Bisaya:`, correctAnswer, `Deutsch:`, germanWord); - vocabMap.set(correctAnswer, { learning: correctAnswer, reference: germanWord }); + const nativeWord = match[1]; // Das Wort in der Muttersprache + console.log(`[importantVocab] Pattern 1 gefunden - Muttersprache:`, nativeWord, `Bisaya:`, correctAnswer); + // learning = Muttersprache (was man lernt), reference = Bisaya (Zielsprache) + vocabMap.set(`${nativeWord}-${correctAnswer}`, { learning: nativeWord, reference: correctAnswer }); } else { - // Pattern 2: "Was bedeutet 'X'?" -> X ist Bisaya, correctAnswer ist Deutsch + // Pattern 2: "Was bedeutet 'X'?" -> X ist Bisaya, correctAnswer ist Muttersprache match = question.match(/Was bedeutet ['"]([^'"]+)['"]/); if (match) { const bisayaWord = match[1]; - console.log(`[importantVocab] Pattern 2 gefunden - Bisaya:`, bisayaWord, `Deutsch:`, correctAnswer); - vocabMap.set(bisayaWord, { learning: bisayaWord, reference: correctAnswer }); + console.log(`[importantVocab] Pattern 2 gefunden - Bisaya:`, bisayaWord, `Muttersprache:`, correctAnswer); + // learning = Muttersprache (was man lernt), reference = Bisaya (Zielsprache) + vocabMap.set(`${correctAnswer}-${bisayaWord}`, { learning: correctAnswer, reference: bisayaWord }); } else { - console.log(`[importantVocab] Kein Pattern gefunden, Fallback`); - // Fallback: Verwende die richtige Antwort als Lernwort - vocabMap.set(correctAnswer, { learning: correctAnswer, reference: correctAnswer }); + console.log(`[importantVocab] Kein Pattern gefunden, Überspringe diese Übung`); + // Überspringe, wenn wir die Richtung nicht erkennen können } } } @@ -397,12 +398,17 @@ export default { console.log(`[importantVocab] Gap Fill - answers:`, answers); if (answers.length > 0) { // Versuche aus dem Text Kontext zu extrahieren + // Gap Fill hat normalerweise Format: "{gap} (Muttersprache) | {gap} (Muttersprache) | ..." const text = qData.text || ''; + // Extrahiere Wörter in Klammern als Muttersprache + const matches = text.matchAll(/\(([^)]+)\)/g); + const nativeWords = Array.from(matches, m => m[1]); + answers.forEach((answer, index) => { if (answer && answer.trim()) { - // Erstelle einen eindeutigen Key - const key = `${answer}-${index}`; - vocabMap.set(key, { learning: answer, reference: answer }); + const nativeWord = nativeWords[index] || answer; // Falls keine Klammer, verwende answer + // Die answer ist normalerweise Bisaya, nativeWord ist Muttersprache + vocabMap.set(`${nativeWord}-${answer}`, { learning: nativeWord, reference: answer }); } }); }