feat(bisaya-course): add didactics fragments for "Haus & Familie" lessons
All checks were successful
Deploy to production / deploy (push) Successful in 2m56s

- Introduced comprehensive didactics snippets for the "Haus & Familie" lesson, including learning goals, core patterns, grammar focus, speaking prompts, and practical tasks.
- Updated the lesson retrieval logic to incorporate these new fragments as a fallback for core patterns, enhancing the robustness of lesson content delivery.
- Modified the vocab service to utilize the new didactics fragments, ensuring a seamless integration into the existing lesson structure.
This commit is contained in:
Torsten Schulz (local)
2026-04-16 22:44:57 +02:00
parent 229bdc96bf
commit 712370cad3
3 changed files with 79 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ import UserParam from '../models/community/user_param.js';
import { sequelize } from '../utils/sequelize.js';
import { notifyUser } from '../utils/socket.js';
import { Op } from 'sequelize';
import { BISAYA_PHASE1_DIDACTICS } from '../scripts/bisaya-course-phase1.js';
import { BISAYA_PHASE1_DIDACTICS, BISAYA_DIDACTICS_FRAGMENTS } from '../scripts/bisaya-course-phase1.js';
export default class VocabService {
_normalizeIsoDate(value) {
@@ -979,13 +979,26 @@ export default class VocabService {
const learningGoals = this._normalizeStringList(plainLesson.learningGoals);
const extractedTrainerVocabs = this._extractTrainerVocabsFromExercises(grammarExercises);
const phase1FallbackCorePatterns = BISAYA_PHASE1_DIDACTICS[plainLesson.title]?.corePatterns || [];
const corePatterns = this._mergeCorePatternGlosses(
let resolvedCorePatterns = this._mergeCorePatternGlosses(
this._enrichCorePatternsWithGloss(
this._normalizeCorePatternList(plainLesson.corePatterns),
extractedTrainerVocabs
),
phase1FallbackCorePatterns
);
if (
!resolvedCorePatterns.length
&& BISAYA_DIDACTICS_FRAGMENTS[plainLesson.title]?.corePatterns?.length
) {
const frag = BISAYA_DIDACTICS_FRAGMENTS[plainLesson.title];
resolvedCorePatterns = this._mergeCorePatternGlosses(
this._enrichCorePatternsWithGloss(
this._normalizeCorePatternList(frag.corePatterns),
extractedTrainerVocabs
),
phase1FallbackCorePatterns
);
}
const grammarFocus = this._normalizeStructuredList(plainLesson.grammarFocus, ['title', 'text', 'example']);
const explicitSpeakingPrompts = this._normalizeStructuredList(plainLesson.speakingPrompts, ['title', 'prompt', 'cue']);
const practicalTasks = this._normalizeStructuredList(plainLesson.practicalTasks, ['title', 'text']);
@@ -998,8 +1011,8 @@ export default class VocabService {
'Ein bis zwei Satzmuster aktiv anwenden.',
'Kurze Sätze oder Mini-Dialoge zum Thema selbst bilden.'
],
corePatterns: corePatterns.length > 0
? corePatterns
corePatterns: resolvedCorePatterns.length > 0
? resolvedCorePatterns
: this._mergeCorePatternGlosses(
this._enrichCorePatternsWithGloss(
uniquePatterns.slice(0, 5).map((s) => ({ target: String(s || '').trim(), gloss: '' })).filter((p) => p.target),