Files
yourpart3/backend/scripts/extend-bisaya-course-phase4.js
Torsten Schulz (local) 9a78bc7c4b
All checks were successful
Deploy to production / deploy (push) Successful in 2m47s
feat(admin): add potential fathers retrieval for character management
- Implemented a new method in AdminService to fetch potential fathers for a given character based on existing relationships.
- Updated AdminController to expose this functionality via a new API endpoint.
- Enhanced adminRouter to include the route for retrieving potential fathers.
- Modified frontend components to allow selection of potential fathers during pregnancy and birth management.
- Updated internationalization files to include new translation keys related to father selection.
2026-03-31 08:50:56 +02:00

103 lines
3.5 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;
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
}
});
if (existing) {
continue;
}
const didactics = BISAYA_PHASE4_DIDACTICS[lessonData.title] || {};
const pedagogy = getBisayaLessonPedagogy(lessonData.num) || {};
await VocabCourseLesson.create({
courseId: course.id,
chapterId: null,
lessonNumber: lessonData.num,
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)
});
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(' 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);
});