All checks were successful
Deploy to production / deploy (push) Successful in 1m31s
- Updated `deploy-yourpart-bluegreen.sh` to pass additional arguments for skipping backend or frontend updates. - Enhanced `update.sh` to handle `--skip-backend` and `--skip-frontend` flags, allowing for more flexible deployment based on changes detected. - Modified deployment workflow to conditionally execute based on changes in frontend or backend files, improving deployment efficiency.
111 lines
3.8 KiB
JavaScript
111 lines
3.8 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Erweitert bestehende Bisaya-Kurse von 4 auf 6 Wochen.
|
|
*
|
|
* Verwendung:
|
|
* node backend/scripts/extend-bisaya-course-phase3.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_PHASE3_DIDACTICS, BISAYA_PHASE3_LESSONS } from './bisaya-course-phase3-extension.js';
|
|
|
|
async function extendBisayaCoursePhase3() {
|
|
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 - Schnellstart in 6 Wochen',
|
|
description: 'Lerne Bisaya (Cebuano) schnell und praktisch für den Familienalltag. Fokus auf Sprechen, Hören, Spiralwiederholung und einem strukturierten 6-Wochen-Plan.'
|
|
});
|
|
|
|
for (const lessonData of BISAYA_PHASE3_LESSONS) {
|
|
const existing = await VocabCourseLesson.findOne({
|
|
where: {
|
|
courseId: course.id,
|
|
lessonNumber: lessonData.num
|
|
}
|
|
});
|
|
|
|
const didactics = BISAYA_PHASE3_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 3 vorbereitet.`);
|
|
console.log(` Kurse: ${courses.length}`);
|
|
console.log(` Neue Lektionen ergänzt: ${addedLessons}`);
|
|
console.log(` Bestehende Lektionen aktualisiert: ${updatedLessons}`);
|
|
console.log(' Danach create-bisaya-course-content.js ausführen, wenn für die neuen Lektionen zusätzliche Übungen eingespielt werden sollen.');
|
|
}
|
|
|
|
extendBisayaCoursePhase3()
|
|
.then(() => {
|
|
sequelize.close();
|
|
process.exit(0);
|
|
})
|
|
.catch((error) => {
|
|
console.error('❌ Fehler:', error);
|
|
sequelize.close();
|
|
process.exit(1);
|
|
});
|