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:
@@ -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 })
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user