Enhance VocabLessonView and VocabService with new learning features

- Added a tabbed interface in VocabLessonView for 'Learn' and 'Exercises' sections, improving user navigation.
- Implemented logic to display important vocabulary and cultural notes in the learning section.
- Updated exercise result display to include correct answers and alternatives for better user feedback.
- Enhanced VocabService to extract correct answers and alternatives from exercise data, supporting the new UI features.
- Added new translations for vocabulary-related terms in both English and German, ensuring consistency across the application.
This commit is contained in:
Torsten Schulz (local)
2026-01-19 16:41:10 +01:00
parent 305e137a1a
commit 196b74bebb
4 changed files with 278 additions and 7 deletions

View File

@@ -1310,8 +1310,20 @@ export default class VocabService {
await progress.save();
}
// Extrahiere richtige Antwort und Alternativen
const answerData = typeof exercise.answerData === 'string'
? JSON.parse(exercise.answerData)
: exercise.answerData;
const correctAnswer = Array.isArray(answerData.correct)
? answerData.correct[0]
: answerData.correct;
const alternatives = answerData.alternatives || [];
return {
correct: isCorrect,
correctAnswer: correctAnswer,
alternatives: alternatives,
explanation: exercise.explanation,
progress: progress.get({ plain: true })
};