Files
yourpart3/backend/scripts/extend-german-for-bisaya-course-phase3.js
Torsten Schulz (local) 0d625f1727
All checks were successful
Deploy to production / deploy (push) Successful in 3m7s
feat(falukant): add age information to lovers in family view
- Updated FalukantService to include age details for partners in relationships.
- Added translations for 'age' in English, German, and Spanish localization files.
- Enhanced FamilyView component to display age information for lovers and candidates, improving user experience.
2026-03-31 11:36:12 +02:00

85 lines
3.2 KiB
JavaScript

#!/usr/bin/env node
import { sequelize } from '../utils/sequelize.js';
import VocabCourse from '../models/community/vocab_course.js';
import VocabCourseLesson from '../models/community/vocab_course_lesson.js';
import { GERMAN_FOR_BISAYA_PHASE3_DIDACTICS, GERMAN_FOR_BISAYA_PHASE3_LESSONS } from './german-for-bisaya-phase3-extension.js';
import { getGermanForBisayaLessonPedagogy } from './german-for-bisaya-phase2-pedagogy.js';
async function getLanguageId(name) {
const [language] = await sequelize.query(
`SELECT id FROM community.vocab_language WHERE name = :name LIMIT 1`,
{ replacements: { name }, type: sequelize.QueryTypes.SELECT }
);
if (!language) throw new Error(`Sprache "${name}" nicht gefunden`);
return Number(language.id);
}
async function extendGermanForBisayaPhase3() {
await sequelize.authenticate();
const germanLanguageId = await getLanguageId('Deutsch');
const bisayaLanguageId = await getLanguageId('Bisaya');
const courses = await VocabCourse.findAll({
where: {
languageId: germanLanguageId,
nativeLanguageId: bisayaLanguageId
}
});
for (const course of courses) {
if (!String(course.title || '').startsWith('Deutsch für Bisaya-Lernende')) continue;
for (const lessonData of GERMAN_FOR_BISAYA_PHASE3_LESSONS) {
const existing = await VocabCourseLesson.findOne({
where: { courseId: course.id, lessonNumber: lessonData.num }
});
if (existing) continue;
const didactics = GERMAN_FOR_BISAYA_PHASE3_DIDACTICS[lessonData.title] || {};
const pedagogy = getGermanForBisayaLessonPedagogy(lessonData.num, lessonData.type);
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,
didacticMode: pedagogy.didacticMode,
phaseLabel: pedagogy.phaseLabel,
blockNumber: pedagogy.blockNumber,
difficultyWeight: pedagogy.difficultyWeight,
newUnitTarget: pedagogy.newUnitTarget,
reviewWeight: pedagogy.reviewWeight,
isIntensiveReview: pedagogy.isIntensiveReview,
culturalNotes: lessonData.cultural,
learningGoals: didactics.learningGoals || null,
corePatterns: didactics.corePatterns || null,
grammarFocus: didactics.grammarFocus || null,
speakingPrompts: didactics.speakingPrompts || null,
practicalTasks: didactics.practicalTasks || null,
targetMinutes: lessonData.targetMin,
targetScorePercent: lessonData.targetScore,
requiresReview: lessonData.review
});
}
course.title = 'Deutsch für Bisaya-Lernende - Alltagspfad';
course.description = '9 Wochen Deutsch-Lernpfad aus Sicht von Bisaya-Lernenden mit Schnellstart, Alltag und typischen Fehlerfeldern.';
await course.save();
console.log(`Phase 3 erweitert: ${course.title} (ID: ${course.id})`);
}
}
if (import.meta.url === `file://${process.argv[1]}`) {
extendGermanForBisayaPhase3()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
}