feat(deploy): enhance deployment scripts with skip options for backend and frontend
All checks were successful
Deploy to production / deploy (push) Successful in 1m31s
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.
This commit is contained in:
@@ -14,7 +14,7 @@ import VocabGrammarExercise from '../models/community/vocab_grammar_exercise.js'
|
||||
import VocabCourse from '../models/community/vocab_course.js';
|
||||
import User from '../models/community/user.js';
|
||||
import { BISAYA_DIDACTICS_24_43, BISAYA_RELATIONSHIP_ANCHOR_DIDACTICS } from './bisaya-course-plan-24-43.js';
|
||||
import { BISAYA_PHASE3_DIDACTICS } from './bisaya-course-phase3-extension.js';
|
||||
import { BISAYA_PHASE3_DIDACTICS, BISAYA_PHASE3_LESSONS } from './bisaya-course-phase3-extension.js';
|
||||
import { BISAYA_PHASE4_DIDACTICS } from './bisaya-course-phase4-extension.js';
|
||||
import { BISAYA_PHASE5_DIDACTICS } from './bisaya-course-phase5-extension.js';
|
||||
|
||||
@@ -33,6 +33,10 @@ const GENERATED_BISAYA_DIDACTICS = {
|
||||
...BISAYA_PHASE5_DIDACTICS
|
||||
};
|
||||
|
||||
const SAFE_EXERCISE_UPDATE_TITLES = new Set(
|
||||
BISAYA_PHASE3_LESSONS.map((lesson) => lesson.title)
|
||||
);
|
||||
|
||||
function normalizeText(value) {
|
||||
return String(value || '')
|
||||
.trim()
|
||||
@@ -5338,6 +5342,7 @@ async function createBisayaCourseContent() {
|
||||
console.log(`Gefunden: ${courses.length} Bisaya-Kurse\n`);
|
||||
|
||||
let totalExercisesAdded = 0;
|
||||
let totalExercisesUpdated = 0;
|
||||
let totalLessonsProcessed = 0;
|
||||
|
||||
for (const course of courses) {
|
||||
@@ -5368,6 +5373,62 @@ async function createBisayaCourseContent() {
|
||||
where: { lessonId: lesson.id }
|
||||
});
|
||||
|
||||
if (existingCount > 0 && !replacePlaceholders && !forceRebuildAll && SAFE_EXERCISE_UPDATE_TITLES.has(lesson.title)) {
|
||||
const lessonDidactics = getLessonDidactics(lesson);
|
||||
const mergedGrammarFocus = mergeGrammarFocusForLesson(
|
||||
lessonDidactics.grammarFocus,
|
||||
buildGrammarCurriculumFocus(lesson)
|
||||
);
|
||||
const derivedCorePatterns = deriveLessonCorePatternsFromExercises(exercises);
|
||||
const mergedCorePatterns = mergeCorePatternsForLesson(lessonDidactics, derivedCorePatterns, 8);
|
||||
await lesson.update({
|
||||
...(mergedGrammarFocus.length > 0 ? { grammarFocus: mergedGrammarFocus } : {}),
|
||||
...(mergedCorePatterns.length >= 8 ? { corePatterns: mergedCorePatterns } : {})
|
||||
});
|
||||
|
||||
const existingExercises = await VocabGrammarExercise.findAll({
|
||||
where: { lessonId: lesson.id },
|
||||
order: [['exerciseNumber', 'ASC']]
|
||||
});
|
||||
|
||||
let exerciseNumber = 1;
|
||||
for (const exerciseData of exercises) {
|
||||
const { exercise } = sanitizeExerciseForConsistency(
|
||||
lesson,
|
||||
exerciseData,
|
||||
lessonDidactics
|
||||
);
|
||||
const exerciseTypeId = await resolveExerciseTypeId(exercise);
|
||||
const existingExercise = existingExercises[exerciseNumber - 1];
|
||||
const payload = {
|
||||
exerciseTypeId,
|
||||
exerciseNumber,
|
||||
title: exercise.title,
|
||||
instruction: exercise.instruction,
|
||||
questionData: JSON.stringify(exercise.questionData),
|
||||
answerData: JSON.stringify(exercise.answerData),
|
||||
explanation: exercise.explanation,
|
||||
createdByUserId: course.ownerUserId || systemUser.id
|
||||
};
|
||||
|
||||
if (existingExercise) {
|
||||
await existingExercise.update(payload);
|
||||
totalExercisesUpdated++;
|
||||
} else {
|
||||
await VocabGrammarExercise.create({
|
||||
lessonId: lesson.id,
|
||||
...payload
|
||||
});
|
||||
totalExercisesAdded++;
|
||||
}
|
||||
exerciseNumber++;
|
||||
}
|
||||
|
||||
console.log(` 🔄 Lektion ${lesson.lessonNumber}: "${lesson.title}" - ${exercises.length} Übung(en) sicher aktualisiert`);
|
||||
totalLessonsProcessed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (existingCount > 0 && !replacePlaceholders && !forceRebuildAll) {
|
||||
console.log(` ⏭️ Lektion ${lesson.lessonNumber}: "${lesson.title}" - bereits ${existingCount} Übung(en) vorhanden`);
|
||||
continue;
|
||||
@@ -5440,6 +5501,7 @@ async function createBisayaCourseContent() {
|
||||
console.log(`\n🎉 Zusammenfassung:`);
|
||||
console.log(` ${totalLessonsProcessed} Lektionen bearbeitet`);
|
||||
console.log(` ${totalExercisesAdded} Grammatik-Übungen erstellt`);
|
||||
console.log(` ${totalExercisesUpdated} Grammatik-Übungen aktualisiert`);
|
||||
}
|
||||
|
||||
createBisayaCourseContent()
|
||||
|
||||
Reference in New Issue
Block a user