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:
Torsten Schulz (local)
2026-01-19 12:09:48 +01:00
parent ddd038761b
commit f902f5298c
2 changed files with 19 additions and 8 deletions

View File

@@ -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();
}