All checks were successful
Deploy to production / deploy (push) Successful in 1m31s
- Expanded the BISAYA_PHASE4_DIDACTICS by adding new learning goals, core patterns, speaking prompts, and practical tasks to improve language acquisition. - Updated the course content generation scripts to incorporate the new lesson structures and ensure alignment with the latest didactic updates. - Enhanced the logic for generating exercises based on lesson types, introducing additional situational and speaking exercises for advanced lessons.
111 lines
3.8 KiB
JavaScript
111 lines
3.8 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Erweitert bestehende Bisaya-Kurse auf den 3-Monats-Alltagspfad.
|
|
*
|
|
* Verwendung:
|
|
* node backend/scripts/extend-bisaya-course-phase4.js
|
|
*/
|
|
|
|
import { sequelize } from '../utils/sequelize.js';
|
|
import VocabCourse from '../models/community/vocab_course.js';
|
|
import VocabCourseLesson from '../models/community/vocab_course_lesson.js';
|
|
import { getBisayaLessonPedagogy } from './bisaya-course-phase2-pedagogy.js';
|
|
import { BISAYA_PHASE4_DIDACTICS, BISAYA_PHASE4_LESSONS } from './bisaya-course-phase4-extension.js';
|
|
|
|
async function extendBisayaCoursePhase4() {
|
|
await sequelize.authenticate();
|
|
|
|
const [bisayaLanguage] = await sequelize.query(
|
|
`SELECT id FROM community.vocab_language WHERE name = 'Bisaya' LIMIT 1`,
|
|
{ type: sequelize.QueryTypes.SELECT }
|
|
);
|
|
|
|
if (!bisayaLanguage) {
|
|
console.error('❌ Bisaya-Sprache nicht gefunden.');
|
|
return;
|
|
}
|
|
|
|
const courses = await VocabCourse.findAll({
|
|
where: { languageId: bisayaLanguage.id }
|
|
});
|
|
|
|
let addedLessons = 0;
|
|
let updatedLessons = 0;
|
|
|
|
for (const course of courses) {
|
|
await course.update({
|
|
title: 'Bisaya für Familien - Alltag in 3 Monaten',
|
|
description: 'Lerne Bisaya (Cebuano) praxisnah für den Familienalltag. Fokus auf Sprechen, Hören, Spiralwiederholung und einem strukturierten 3-Monats-Pfad vom Schnellstart bis zur stabilen Alltagskommunikation.'
|
|
});
|
|
|
|
for (const lessonData of BISAYA_PHASE4_LESSONS) {
|
|
const existing = await VocabCourseLesson.findOne({
|
|
where: {
|
|
courseId: course.id,
|
|
lessonNumber: lessonData.num
|
|
}
|
|
});
|
|
|
|
const didactics = BISAYA_PHASE4_DIDACTICS[lessonData.title] || {};
|
|
const pedagogy = getBisayaLessonPedagogy(lessonData.num) || {};
|
|
const lessonPayload = {
|
|
title: lessonData.title,
|
|
description: lessonData.desc,
|
|
weekNumber: lessonData.week,
|
|
dayNumber: lessonData.day,
|
|
lessonType: lessonData.type,
|
|
culturalNotes: lessonData.cultural,
|
|
learningGoals: didactics.learningGoals || [],
|
|
corePatterns: didactics.corePatterns || [],
|
|
grammarFocus: didactics.grammarFocus || [],
|
|
speakingPrompts: didactics.speakingPrompts || [],
|
|
practicalTasks: didactics.practicalTasks || [],
|
|
targetMinutes: lessonData.targetMin,
|
|
targetScorePercent: lessonData.targetScore,
|
|
requiresReview: lessonData.review,
|
|
didacticMode: pedagogy.didacticMode || null,
|
|
phaseLabel: pedagogy.phaseLabel || null,
|
|
blockNumber: pedagogy.blockNumber ?? null,
|
|
difficultyWeight: pedagogy.difficultyWeight ?? null,
|
|
newUnitTarget: pedagogy.newUnitTarget ?? null,
|
|
reviewWeight: pedagogy.reviewWeight ?? null,
|
|
isIntensiveReview: Boolean(pedagogy.isIntensiveReview)
|
|
};
|
|
|
|
if (existing) {
|
|
await existing.update(lessonPayload);
|
|
updatedLessons++;
|
|
console.log(`🔄 Kurs ${course.id}: Lektion ${lessonData.num} - ${lessonData.title} aktualisiert`);
|
|
continue;
|
|
}
|
|
|
|
await VocabCourseLesson.create({
|
|
...lessonPayload,
|
|
courseId: course.id,
|
|
chapterId: null,
|
|
lessonNumber: lessonData.num
|
|
});
|
|
|
|
addedLessons++;
|
|
console.log(`✅ Kurs ${course.id}: Lektion ${lessonData.num} - ${lessonData.title} ergänzt`);
|
|
}
|
|
}
|
|
|
|
console.log(`\n🎉 Phase 4 vorbereitet.`);
|
|
console.log(` Kurse: ${courses.length}`);
|
|
console.log(` Neue Lektionen ergänzt: ${addedLessons}`);
|
|
console.log(` Bestehende Lektionen aktualisiert: ${updatedLessons}`);
|
|
console.log(' Das Einspielen in die DB kann später gesammelt mit den übrigen Phasen erfolgen.');
|
|
}
|
|
|
|
extendBisayaCoursePhase4()
|
|
.then(() => {
|
|
sequelize.close();
|
|
process.exit(0);
|
|
})
|
|
.catch((error) => {
|
|
console.error('❌ Fehler:', error);
|
|
sequelize.close();
|
|
process.exit(1);
|
|
});
|