From d808d54dd6838baaf82eb46ff3fd8c42b64abf9e Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Tue, 26 May 2026 16:09:21 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20erweitere=20gap=5Ffill-=C3=9Cbungen,=20?= =?UTF-8?q?um=20mehrere=20W=C3=B6rter=20in=20Referenzen=20zu=20unterst?= =?UTF-8?q?=C3=BCtzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/social/VocabLessonView.vue | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/social/VocabLessonView.vue b/frontend/src/views/social/VocabLessonView.vue index 5aaf93d..7a6cdd8 100644 --- a/frontend/src/views/social/VocabLessonView.vue +++ b/frontend/src/views/social/VocabLessonView.vue @@ -2822,14 +2822,30 @@ export default { 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)}`; + // Wenn reference mehrere Wörter enthält, ersetze das erste Wort durch die Lücke + const ref = String(item.reference || '').trim(); + let qText = `{gap} (${item.learning})`; + let answers = [ref]; + if (ref) { + const parts = ref.split(/\s+/).filter(Boolean); + if (parts.length > 1) { + const tail = parts.slice(1).join(' '); + qText = `{gap} ${tail}`; + answers = [parts[0]]; + } else { + // single token reference: show blank plus learning hint + qText = `{gap} (${item.learning})`; + answers = [parts[0]]; + } + } 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] } + questionData: { type: 'gap_fill', text: qText }, + answerData: { type: 'gap_fill', answers } }; }); this.lesson.grammarExercises = Array.isArray(this.lesson.grammarExercises)