feat(vocab): add course language name handling in VocabLessonView
All checks were successful
Deploy to production / deploy (push) Successful in 2m48s
All checks were successful
Deploy to production / deploy (push) Successful in 2m48s
- Introduced new properties for course language names to enhance clarity in vocabulary preparation. - Implemented a method to load course language names from the API, improving localization and user experience. - Updated label logic to utilize course-specific language names, ensuring accurate representation in vocabulary lessons.
This commit is contained in:
@@ -1012,6 +1012,8 @@ export default {
|
|||||||
exerciseSequentialIndex: 0,
|
exerciseSequentialIndex: 0,
|
||||||
/** Aus vorherigen Lektionen (MC-Optionen nach Fragentyp Ziel-/Muttersprache) */
|
/** Aus vorherigen Lektionen (MC-Optionen nach Fragentyp Ziel-/Muttersprache) */
|
||||||
distractorPool: { target: [], native: [] },
|
distractorPool: { target: [], native: [] },
|
||||||
|
courseLanguageName: '',
|
||||||
|
courseNativeLanguageName: '',
|
||||||
/** Fortschritt aller Kurslektionen inkl. lessonState für Spezial-Trainer-Boost */
|
/** Fortschritt aller Kurslektionen inkl. lessonState für Spezial-Trainer-Boost */
|
||||||
courseProgressList: [],
|
courseProgressList: [],
|
||||||
/** { [exerciseId]: { options: string[], useTextAnswer: boolean } } */
|
/** { [exerciseId]: { options: string[], useTextAnswer: boolean } } */
|
||||||
@@ -1297,14 +1299,16 @@ export default {
|
|||||||
},
|
},
|
||||||
prepTargetLabel() {
|
prepTargetLabel() {
|
||||||
return String(
|
return String(
|
||||||
this.lesson?.course?.languageName
|
this.courseLanguageName
|
||||||
|
|| this.lesson?.course?.languageName
|
||||||
|| this.lesson?.languageName
|
|| this.lesson?.languageName
|
||||||
|| this.$t('socialnetwork.vocab.courses.vocabPrepTargetLabel')
|
|| this.$t('socialnetwork.vocab.courses.vocabPrepTargetLabel')
|
||||||
).toUpperCase();
|
).toUpperCase();
|
||||||
},
|
},
|
||||||
prepGlossLabel() {
|
prepGlossLabel() {
|
||||||
return String(
|
return String(
|
||||||
this.lesson?.course?.nativeLanguageName
|
this.courseNativeLanguageName
|
||||||
|
|| this.lesson?.course?.nativeLanguageName
|
||||||
|| this.lesson?.nativeLanguageName
|
|| this.lesson?.nativeLanguageName
|
||||||
|| this.$t('socialnetwork.vocab.courses.vocabPrepGlossLabel')
|
|| this.$t('socialnetwork.vocab.courses.vocabPrepGlossLabel')
|
||||||
).toUpperCase();
|
).toUpperCase();
|
||||||
@@ -2133,6 +2137,8 @@ export default {
|
|||||||
this.vocabTrainerCurrentAttempts = 0;
|
this.vocabTrainerCurrentAttempts = 0;
|
||||||
this.vocabTrainerReviewAttempts = 0;
|
this.vocabTrainerReviewAttempts = 0;
|
||||||
this.courseProgressList = [];
|
this.courseProgressList = [];
|
||||||
|
this.courseLanguageName = '';
|
||||||
|
this.courseNativeLanguageName = '';
|
||||||
this.distractorPool = { target: [], native: [] };
|
this.distractorPool = { target: [], native: [] };
|
||||||
this.mcRandomizedOptions = {};
|
this.mcRandomizedOptions = {};
|
||||||
// Reset Flags
|
// Reset Flags
|
||||||
@@ -2154,6 +2160,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const res = await apiClient.get(`/api/vocab/lessons/${this.lessonId}`);
|
const res = await apiClient.get(`/api/vocab/lessons/${this.lessonId}`);
|
||||||
this.lesson = res.data;
|
this.lesson = res.data;
|
||||||
|
await this.loadCourseLanguageNames();
|
||||||
await this.loadCourseProgressForBoost();
|
await this.loadCourseProgressForBoost();
|
||||||
debugLog('[VocabLessonView] Geladene Lektion:', this.lesson?.id, this.lesson?.title);
|
debugLog('[VocabLessonView] Geladene Lektion:', this.lesson?.id, this.lesson?.title);
|
||||||
if (this.$route.query.assistant) {
|
if (this.$route.query.assistant) {
|
||||||
@@ -2199,6 +2206,16 @@ export default {
|
|||||||
this.courseProgressList = [];
|
this.courseProgressList = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async loadCourseLanguageNames() {
|
||||||
|
try {
|
||||||
|
const { data } = await apiClient.get(`/api/vocab/courses/${this.courseId}`);
|
||||||
|
this.courseLanguageName = String(data?.languageName || '').trim();
|
||||||
|
this.courseNativeLanguageName = String(data?.nativeLanguageName || '').trim();
|
||||||
|
} catch (e) {
|
||||||
|
this.courseLanguageName = '';
|
||||||
|
this.courseNativeLanguageName = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
focusAssistantCard() {
|
focusAssistantCard() {
|
||||||
const target = this.$refs.assistantCard;
|
const target = this.$refs.assistantCard;
|
||||||
if (!target || typeof target.scrollIntoView !== 'function') {
|
if (!target || typeof target.scrollIntoView !== 'function') {
|
||||||
|
|||||||
Reference in New Issue
Block a user