diff --git a/backend/scripts/create-bisaya-course-content.js b/backend/scripts/create-bisaya-course-content.js index 35d3d13..7c5498c 100644 --- a/backend/scripts/create-bisaya-course-content.js +++ b/backend/scripts/create-bisaya-course-content.js @@ -39,14 +39,14 @@ const BISAYA_EXERCISES = { instruction: 'Fülle die Lücken mit den richtigen Bisaya-Wörtern.', questionData: { type: 'gap_fill', - text: 'Kumusta ka? Maayo {gap}. Salamat.', + text: 'Kumusta ka? Maayo {gap} (ich). Salamat.', gaps: 1 }, answerData: { type: 'gap_fill', answers: ['ko'] }, - explanation: '"Maayo ko" bedeutet "Mir geht es gut".' + explanation: '"Maayo ko" bedeutet "Mir geht es gut". "ko" ist "ich" auf Bisaya.' }, { exerciseTypeId: 2, // multiple_choice @@ -267,7 +267,7 @@ const BISAYA_EXERCISES = { instruction: 'Fülle die Lücken mit höflichen Wörtern.', questionData: { type: 'gap_fill', - text: '{gap} lang, wala ko kasabot. {gap} ka mubalik?', + text: '{gap} lang (Bitte langsam), wala ko kasabot. {gap} ka mubalik? (Bitte wiederholen)', gaps: 2 }, answerData: { @@ -331,7 +331,7 @@ const BISAYA_EXERCISES = { instruction: 'Fülle die Lücken mit den richtigen Bisaya-Wörtern.', questionData: { type: 'gap_fill', - text: '{gap} ko kasabot. {gap} ka mubalik? {gap} lang.', + text: '{gap} ko kasabot (Ich verstehe nicht). {gap} ka mubalik? (Bitte wiederholen) {gap} lang (Bitte langsam).', gaps: 3 }, answerData: { @@ -472,7 +472,7 @@ const BISAYA_EXERCISES = { instruction: 'Fülle die Lücken mit den richtigen Bisaya-Wörtern.', questionData: { type: 'gap_fill', - text: '{gap} ko kasabot. {gap} ka mubalik?', + text: '{gap} ko kasabot (Ich verstehe nicht). {gap} ka mubalik? (Bitte wiederholen)', gaps: 2 }, answerData: { diff --git a/backend/scripts/fix-begruessungen-gap-fill.js b/backend/scripts/fix-begruessungen-gap-fill.js new file mode 100755 index 0000000..7d52100 --- /dev/null +++ b/backend/scripts/fix-begruessungen-gap-fill.js @@ -0,0 +1,89 @@ +#!/usr/bin/env node +/** + * Script zum Korrigieren der Gap-Fill-Übung in "Begrüßungen & Höflichkeit" + * Fügt Muttersprache-Hinweise hinzu, damit Vokabeln korrekt extrahiert werden können + */ + +import { sequelize } from '../utils/sequelize.js'; +import VocabCourseLesson from '../models/community/vocab_course_lesson.js'; +import VocabGrammarExercise from '../models/community/vocab_grammar_exercise.js'; +import VocabCourse from '../models/community/vocab_course.js'; + +async function fixBegruessungenGapFill() { + await sequelize.authenticate(); + console.log('Datenbankverbindung erfolgreich hergestellt.\n'); + + // Finde alle "Begrüßungen & Höflichkeit" Lektionen + const lessons = await VocabCourseLesson.findAll({ + where: { title: 'Begrüßungen & Höflichkeit' }, + include: [{ model: VocabCourse, as: 'course' }] + }); + + console.log(`Gefunden: ${lessons.length} "Begrüßungen & Höflichkeit"-Lektionen\n`); + + let totalUpdated = 0; + + for (const lesson of lessons) { + console.log(`📚 Kurs: ${lesson.course.title} (Kurs-ID: ${lesson.course.id}, Lektion-ID: ${lesson.id})`); + + // Finde Gap-Fill-Übung mit "ko" als Antwort + const exercises = await VocabGrammarExercise.findAll({ + where: { + lessonId: lesson.id, + exerciseTypeId: 1 // gap_fill + } + }); + + for (const exercise of exercises) { + const qData = typeof exercise.questionData === 'string' + ? JSON.parse(exercise.questionData) + : exercise.questionData; + const aData = typeof exercise.answerData === 'string' + ? JSON.parse(exercise.answerData) + : exercise.answerData; + + // Prüfe ob es die problematische Übung ist (enthält "ko" als Antwort ohne Muttersprache-Hinweis) + if (aData.answers && aData.answers.includes('ko')) { + const text = qData.text || ''; + + // Prüfe ob Muttersprache-Hinweise fehlen + if (!text.includes('(ich)') && !text.includes('(I)')) { + console.log(` 🔧 Korrigiere Übung "${exercise.title}" (ID: ${exercise.id})`); + + // Korrigiere den Text + const correctedText = text.replace( + 'Maayo {gap}.', + 'Maayo {gap} (ich).' + ); + + qData.text = correctedText; + + await exercise.update({ + questionData: qData + }); + + totalUpdated++; + console.log(` ✅ Aktualisiert: "${correctedText}"`); + } else { + console.log(` ✓ Übung "${exercise.title}" bereits korrekt`); + } + } + } + console.log(''); + } + + console.log(`\n🎉 Zusammenfassung:`); + console.log(` ${lessons.length} Lektionen verarbeitet`); + console.log(` ${totalUpdated} Übungen aktualisiert`); +} + +fixBegruessungenGapFill() + .then(() => { + sequelize.close(); + process.exit(0); + }) + .catch((error) => { + console.error('❌ Fehler:', error); + sequelize.close(); + process.exit(1); + }); diff --git a/frontend/src/views/social/VocabLessonView.vue b/frontend/src/views/social/VocabLessonView.vue index c85aa55..c53cb50 100644 --- a/frontend/src/views/social/VocabLessonView.vue +++ b/frontend/src/views/social/VocabLessonView.vue @@ -121,8 +121,8 @@ {{ $t('socialnetwork.vocab.courses.checkAnswer') }} - -