Refactor native language filtering in VocabService and update frontend handling
- Simplified the logic for filtering courses by native language in VocabService, allowing for better handling of undefined and null values. - Enhanced the VocabCourseListView to clarify the behavior of nativeLanguageId based on user selection, ensuring accurate course retrieval based on language preferences. - Improved comments in both files for better understanding of the filtering logic and its implications on course visibility.
This commit is contained in:
@@ -172,9 +172,21 @@ export default {
|
||||
if (this.selectedLanguageId) {
|
||||
params.languageId = this.selectedLanguageId;
|
||||
}
|
||||
// Nur nativeLanguageId senden, wenn explizit eine Sprache ausgewählt wurde
|
||||
// Leer bedeutet: zeige alle Kurse
|
||||
// "null" bedeutet: zeige nur Kurse ohne Muttersprache
|
||||
// Eine ID bedeutet: zeige nur Kurse für diese Muttersprache
|
||||
if (this.selectedNativeLanguageId !== '') {
|
||||
params.nativeLanguageId = this.selectedNativeLanguageId === 'null' ? null : this.selectedNativeLanguageId;
|
||||
if (this.selectedNativeLanguageId === 'null') {
|
||||
// Explizit Kurse ohne Muttersprache anfordern
|
||||
params.nativeLanguageId = null;
|
||||
} else {
|
||||
// Spezifische Muttersprache
|
||||
params.nativeLanguageId = this.selectedNativeLanguageId;
|
||||
}
|
||||
}
|
||||
// Wenn selectedNativeLanguageId leer ist, wird nativeLanguageId nicht gesetzt
|
||||
// und das Backend zeigt alle Kurse an
|
||||
if (this.searchTerm.trim()) {
|
||||
params.search = this.searchTerm.trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user