From 41b07a8951aa2905472a4c81f291e6a09974861e Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Thu, 16 Apr 2026 16:42:48 +0200 Subject: [PATCH] fix(bisaya-course): update alternatives for transformation exercise - Modified the alternatives for a transformation exercise to include additional variations, enhancing the response options for learners. - Updated the vocabulary service to incorporate both primary and alternative answers, improving the accuracy of answer validation during exercises. --- backend/scripts/create-bisaya-course-content.js | 2 +- backend/services/vocabService.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/scripts/create-bisaya-course-content.js b/backend/scripts/create-bisaya-course-content.js index f870de5..17110ee 100644 --- a/backend/scripts/create-bisaya-course-content.js +++ b/backend/scripts/create-bisaya-course-content.js @@ -2026,7 +2026,7 @@ const BISAYA_EXERCISES = { answerData: { type: 'transformation', correct: 'Karon', - alternatives: ['Karong adlawa'] + alternatives: ['Karong adlawa', 'Karong adlawa', 'Karong adlawa.'] }, explanation: '"karon" heißt „jetzt/heute“. „karong adlawa“ ist eine betonte Form für „heute“.' }, diff --git a/backend/services/vocabService.js b/backend/services/vocabService.js index 7185ee2..6d8c769 100644 --- a/backend/services/vocabService.js +++ b/backend/services/vocabService.js @@ -3622,9 +3622,13 @@ export default class VocabService { .some((answer) => answer === normalizedUser); } - // Für andere Typen: einfacher String-Vergleich (kann später erweitert werden) - const correctAnswers = parsedAnswerData.correct || parsedAnswerData.correctAnswer || []; - const correctAnswersArray = Array.isArray(correctAnswers) ? correctAnswers : [correctAnswers]; + // Für andere Typen: einfacher String-Vergleich inkl. hinterlegter Alternativen + const primaryAnswers = parsedAnswerData.correct || parsedAnswerData.correctAnswer || []; + const primaryAnswersArray = Array.isArray(primaryAnswers) ? primaryAnswers : [primaryAnswers]; + const alternativeAnswersArray = Array.isArray(parsedAnswerData.alternatives) + ? parsedAnswerData.alternatives + : []; + const correctAnswersArray = [...primaryAnswersArray, ...alternativeAnswersArray]; const normalizedUserAnswer = this._normalizeTextAnswer(userAnswer); return correctAnswersArray.some(correct => this._normalizeTextAnswer(correct) === normalizedUserAnswer); }