feat(course): add Cebu travel path with lessons and didactics for Bisaya courses
All checks were successful
Deploy to production / deploy (push) Successful in 24s
All checks were successful
Deploy to production / deploy (push) Successful in 24s
This commit is contained in:
69
backend/scripts/extend-bisaya-course-cebu-travel.js
Normal file
69
backend/scripts/extend-bisaya-course-cebu-travel.js
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env node
|
||||
/** Fügt Bisaya-Kursen den optionalen Reisepfad „Cebu – Reise & Alltag“ hinzu. */
|
||||
|
||||
import { sequelize } from '../utils/sequelize.js';
|
||||
import VocabCourse from '../models/community/vocab_course.js';
|
||||
import VocabCourseLesson from '../models/community/vocab_course_lesson.js';
|
||||
import { BISAYA_CEBU_TRAVEL_DIDACTICS, BISAYA_CEBU_TRAVEL_LESSONS } from './bisaya-course-cebu-travel-extension.js';
|
||||
|
||||
async function extendBisayaCourseForCebuTravel() {
|
||||
await sequelize.authenticate();
|
||||
const [language] = await sequelize.query(
|
||||
`SELECT id FROM community.vocab_language WHERE name = 'Bisaya' LIMIT 1`,
|
||||
{ type: sequelize.QueryTypes.SELECT }
|
||||
);
|
||||
if (!language) throw new Error('Bisaya-Sprache nicht gefunden.');
|
||||
|
||||
const courses = await VocabCourse.findAll({ where: { languageId: language.id } });
|
||||
let addedLessons = 0;
|
||||
for (const course of courses) {
|
||||
await course.update({
|
||||
title: 'Bisaya für Cebu – Reise, Familie & Alltag',
|
||||
description: 'Praxisnahes Cebuano für Reisen und längere Aufenthalte auf Cebu: Unterkunft, Essen, Markt, Ausflüge, Familie, Höflichkeit und Hilfe unterwegs.'
|
||||
});
|
||||
for (const lessonData of BISAYA_CEBU_TRAVEL_LESSONS) {
|
||||
const existing = await VocabCourseLesson.findOne({
|
||||
where: { courseId: course.id, lessonNumber: lessonData.num }
|
||||
});
|
||||
if (existing) continue;
|
||||
const didactics = BISAYA_CEBU_TRAVEL_DIDACTICS[lessonData.title];
|
||||
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: 'travel_practice',
|
||||
phaseLabel: 'Cebu – Reise & Alltag',
|
||||
blockNumber: 8,
|
||||
difficultyWeight: 1,
|
||||
newUnitTarget: 8,
|
||||
reviewWeight: lessonData.review ? 2 : 1,
|
||||
isIntensiveReview: false
|
||||
});
|
||||
addedLessons += 1;
|
||||
console.log(`✅ Kurs ${course.id}: Lektion ${lessonData.num} – ${lessonData.title} ergänzt`);
|
||||
}
|
||||
}
|
||||
console.log(`Cebu-Reisepfad: ${addedLessons} Lektionen ergänzt.`);
|
||||
}
|
||||
|
||||
extendBisayaCourseForCebuTravel()
|
||||
.then(() => sequelize.close())
|
||||
.catch((error) => {
|
||||
console.error('❌ Fehler:', error);
|
||||
sequelize.close();
|
||||
process.exitCode = 1;
|
||||
});
|
||||
Reference in New Issue
Block a user