feat: füge Unterstützung für temporäre gap_fill-Übungen aus chapterLexemeTraining hinzu
All checks were successful
Deploy to production / deploy (push) Successful in 2m0s

This commit is contained in:
Torsten Schulz (local)
2026-05-26 16:04:36 +02:00
parent 1232edd570
commit 52ee406165
2 changed files with 41 additions and 0 deletions

View File

@@ -2816,6 +2816,30 @@ export default {
}
await this.$nextTick();
let exercises = this.effectiveExercises;
// Wenn das Backend eine chapterLexemeTraining-Liste liefert, wandle sie
// in temporäre gap_fill-Übungen um und mische sie in die grammarExercises
try {
if (this.lesson && Array.isArray(this.lesson.chapterLexemeTraining) && this.lesson.chapterLexemeTraining.length) {
const temps = this.lesson.chapterLexemeTraining.map((item, idx) => {
const id = `cht-${this.lesson.id}-${String(item.id)}`;
return {
id,
lessonId: this.lesson.id,
exerciseTypeId: 1,
title: `Kapitel-Vokabel: ${item.learning}`,
instruction: this.$t('socialnetwork.vocab.courses.fillTheBlank') || 'Lückentext',
questionData: { type: 'gap_fill', text: `{gap} (${item.learning})` },
answerData: { type: 'gap_fill', answers: [item.reference] }
};
});
this.lesson.grammarExercises = Array.isArray(this.lesson.grammarExercises)
? [...this.lesson.grammarExercises, ...temps]
: temps;
exercises = this.effectiveExercises;
}
} catch (err) {
console.warn('[VocabLessonView] Fehler beim Einfügen von chapterLexemeTraining:', err);
}
if (!exercises || exercises.length === 0) {
debugLog('[VocabLessonView] Lade Übungen separat...');
await this.loadGrammarExercises();