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
All checks were successful
Deploy to production / deploy (push) Successful in 2m0s
This commit is contained in:
@@ -2881,6 +2881,23 @@ export default class VocabService {
|
||||
});
|
||||
|
||||
const plainLesson = lesson.get({ plain: true });
|
||||
// Normalize exercise types: if question text contains clear gap placeholders,
|
||||
// ensure the questionData.type is 'gap_fill' so the frontend renders the gap UI.
|
||||
(plainLesson.grammarExercises || []).forEach((ex) => {
|
||||
try {
|
||||
const qData = typeof ex.questionData === 'string' ? JSON.parse(ex.questionData || '{}') : (ex.questionData || {});
|
||||
const text = String(qData.text || qData.question || '').trim();
|
||||
const hasUnderscoreGap = /_{3,}/.test(text);
|
||||
const hasBraceGap = /\{\s*gap\s*\}/i.test(text);
|
||||
const hasParenPlaceholders = /\(\s*_{0,}\s*\)/.test(text);
|
||||
if ((hasUnderscoreGap || hasBraceGap || hasParenPlaceholders) && qData.type !== 'gap_fill') {
|
||||
qData.type = 'gap_fill';
|
||||
ex.questionData = qData;
|
||||
}
|
||||
} catch (err) {
|
||||
// ignore parse errors
|
||||
}
|
||||
});
|
||||
|
||||
// Lade Vokabeln aus vorherigen Lektionen (für Wiederholung UND für gemischten Vokabeltrainer)
|
||||
if (plainLesson.lessonNumber > 1) {
|
||||
|
||||
Reference in New Issue
Block a user