feat: erweitere gap_fill-Übungen, um mehrere Wörter in Referenzen zu unterstützen
All checks were successful
Deploy to production / deploy (push) Successful in 1m58s
All checks were successful
Deploy to production / deploy (push) Successful in 1m58s
This commit is contained in:
@@ -2822,14 +2822,30 @@ export default {
|
|||||||
if (this.lesson && Array.isArray(this.lesson.chapterLexemeTraining) && this.lesson.chapterLexemeTraining.length) {
|
if (this.lesson && Array.isArray(this.lesson.chapterLexemeTraining) && this.lesson.chapterLexemeTraining.length) {
|
||||||
const temps = this.lesson.chapterLexemeTraining.map((item, idx) => {
|
const temps = this.lesson.chapterLexemeTraining.map((item, idx) => {
|
||||||
const id = `cht-${this.lesson.id}-${String(item.id)}`;
|
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 {
|
return {
|
||||||
id,
|
id,
|
||||||
lessonId: this.lesson.id,
|
lessonId: this.lesson.id,
|
||||||
exerciseTypeId: 1,
|
exerciseTypeId: 1,
|
||||||
title: `Kapitel-Vokabel: ${item.learning}`,
|
title: `Kapitel-Vokabel: ${item.learning}`,
|
||||||
instruction: this.$t('socialnetwork.vocab.courses.fillTheBlank') || 'Lückentext',
|
instruction: this.$t('socialnetwork.vocab.courses.fillTheBlank') || 'Lückentext',
|
||||||
questionData: { type: 'gap_fill', text: `{gap} (${item.learning})` },
|
questionData: { type: 'gap_fill', text: qText },
|
||||||
answerData: { type: 'gap_fill', answers: [item.reference] }
|
answerData: { type: 'gap_fill', answers }
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.lesson.grammarExercises = Array.isArray(this.lesson.grammarExercises)
|
this.lesson.grammarExercises = Array.isArray(this.lesson.grammarExercises)
|
||||||
|
|||||||
Reference in New Issue
Block a user