diff --git a/backend/scripts/update-food-care-exercises.js b/backend/scripts/update-food-care-exercises.js index f960c1d..a97d7d1 100755 --- a/backend/scripts/update-food-care-exercises.js +++ b/backend/scripts/update-food-care-exercises.js @@ -512,16 +512,24 @@ async function updateFoodCareExercises() { return; } - const courses = await VocabCourse.findAll({ - where: { languageId: bisayaLanguage.id }, - include: [ - { - model: sequelize.models.VocabLanguage, - as: 'nativeLanguage', - attributes: ['name'] - } - ] - }); + const bisayaLanguageId = bisayaLanguage.id; + + // Hole alle Bisaya-Kurse mit native language info + const courses = await sequelize.query( + `SELECT + c.id, + c.title, + c.owner_user_id, + c.native_language_id, + nl.name as native_language_name + FROM community.vocab_course c + LEFT JOIN community.vocab_language nl ON c.native_language_id = nl.id + WHERE c.language_id = :bisayaLanguageId`, + { + replacements: { bisayaLanguageId }, + type: sequelize.QueryTypes.SELECT + } + ); console.log(`Gefunden: ${courses.length} Bisaya-Kurse\n`); @@ -530,7 +538,7 @@ async function updateFoodCareExercises() { for (const course of courses) { console.log(`📚 Kurs: ${course.title} (ID: ${course.id})`); - const nativeLangName = course.nativeLanguage?.name || 'Deutsch'; + const nativeLangName = course.native_language_name || 'Deutsch'; console.log(` Muttersprache: ${nativeLangName}`); // Finde "Essen & Fürsorge" und "Essen & Trinken" Lektionen @@ -587,7 +595,7 @@ async function updateFoodCareExercises() { correctAnswer: 0 }), explanation: conv.explanation, - createdByUserId: course.ownerUserId || systemUser.id + createdByUserId: course.owner_user_id || systemUser.id }); totalExercisesCreated++; @@ -613,7 +621,7 @@ async function updateFoodCareExercises() { correctAnswer: 0 }), explanation: conv.explanation, - createdByUserId: course.ownerUserId || systemUser.id + createdByUserId: course.owner_user_id || systemUser.id }); totalExercisesCreated++; } @@ -639,7 +647,7 @@ async function updateFoodCareExercises() { alternatives: [] }), explanation: conv.explanation, - createdByUserId: course.ownerUserId || systemUser.id + createdByUserId: course.owner_user_id || systemUser.id }); totalExercisesCreated++; } @@ -668,7 +676,7 @@ async function updateFoodCareExercises() { correctAnswer: 0 }), explanation: vocab.explanation, - createdByUserId: course.ownerUserId || systemUser.id + createdByUserId: course.owner_user_id || systemUser.id }); totalExercisesCreated++; @@ -694,7 +702,7 @@ async function updateFoodCareExercises() { correctAnswer: 0 }), explanation: vocab.explanation, - createdByUserId: course.ownerUserId || systemUser.id + createdByUserId: course.owner_user_id || systemUser.id }); totalExercisesCreated++; } diff --git a/frontend/src/i18n/locales/de/socialnetwork.json b/frontend/src/i18n/locales/de/socialnetwork.json index a8eba95..987244a 100644 --- a/frontend/src/i18n/locales/de/socialnetwork.json +++ b/frontend/src/i18n/locales/de/socialnetwork.json @@ -408,7 +408,8 @@ "recordingError": "Aufnahme-Fehler", "recognizedText": "Erkannter Text", "speechRecognitionNotSupported": "Speech Recognition wird von diesem Browser nicht unterstützt. Bitte verwende Chrome oder Edge.", - "keywords": "Schlüsselwörter" + "keywords": "Schlüsselwörter", + "switchBackToMultipleChoice": "Zurück zu Multiple Choice" } } } diff --git a/frontend/src/i18n/locales/en/socialnetwork.json b/frontend/src/i18n/locales/en/socialnetwork.json index 77fa422..7e3c913 100644 --- a/frontend/src/i18n/locales/en/socialnetwork.json +++ b/frontend/src/i18n/locales/en/socialnetwork.json @@ -408,7 +408,8 @@ "recordingError": "Recording error", "recognizedText": "Recognized Text", "speechRecognitionNotSupported": "Speech Recognition is not supported by this browser. Please use Chrome or Edge.", - "keywords": "Keywords" + "keywords": "Keywords", + "switchBackToMultipleChoice": "Switch back to Multiple Choice" } } } diff --git a/frontend/src/views/social/VocabLessonView.vue b/frontend/src/views/social/VocabLessonView.vue index 3522154..69a35de 100644 --- a/frontend/src/views/social/VocabLessonView.vue +++ b/frontend/src/views/social/VocabLessonView.vue @@ -110,6 +110,11 @@